Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e87118e5
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
未验证
提交
e87118e5
编写于
8月 13, 2021
作者:
H
Haojun Liao
提交者:
GitHub
8月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into feature/master1
上级
0309fd44
23e27ebb
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
501 addition
and
108 deletion
+501
-108
deps/TSZ
deps/TSZ
+1
-1
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+3
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+10
-6
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+16
-0
src/connector/nodejs/nodetaos/taosobjects.js
src/connector/nodejs/nodetaos/taosobjects.js
+2
-1
src/connector/nodejs/package.json
src/connector/nodejs/package.json
+1
-1
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+2
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+81
-44
src/kit/taospack/taospack.c
src/kit/taospack/taospack.c
+49
-3
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+7
-4
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+3
-0
src/tsdb/inc/tsdbFS.h
src/tsdb/inc/tsdbFS.h
+4
-1
src/tsdb/src/tsdbFS.c
src/tsdb/src/tsdbFS.c
+1
-2
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+12
-0
src/util/inc/tcompare.h
src/util/inc/tcompare.h
+1
-1
src/util/src/tcompare.c
src/util/src/tcompare.c
+7
-5
tests/perftest-scripts/perftest-query.sh
tests/perftest-scripts/perftest-query.sh
+7
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+3
-2
tests/pytest/functions/showOfflineThresholdIs864000.py
tests/pytest/functions/showOfflineThresholdIs864000.py
+1
-1
tests/pytest/query/queryError.py
tests/pytest/query/queryError.py
+4
-0
tests/pytest/query/queryWildcardLength.py
tests/pytest/query/queryWildcardLength.py
+207
-0
tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
...demoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
+43
-30
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
...st/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
+1
-1
tests/pytest/tools/taosdemoPerformance.py
tests/pytest/tools/taosdemoPerformance.py
+1
-2
tests/pytest/tools/taosdemoTestInterlace.py
tests/pytest/tools/taosdemoTestInterlace.py
+1
-1
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+16
-0
tests/script/general/parser/interp.sim
tests/script/general/parser/interp.sim
+16
-1
未找到文件。
TSZ
@
ceda5bf9
比较
0ca5b15a
...
ceda5bf9
Subproject commit
0ca5b15a8eac40327dd737be52c926fa5675712c
Subproject commit
ceda5bf9fcd7836509ac97dcc0056b3f1dd48cc5
packaging/cfg/taos.cfg
浏览文件 @
e87118e5
...
@@ -144,6 +144,9 @@ keepColumnName 1
...
@@ -144,6 +144,9 @@ keepColumnName 1
# max length of an SQL
# max length of an SQL
# maxSQLLength 65480
# maxSQLLength 65480
# max length of WildCards
# maxWildCardsLength 100
# the maximum number of records allowed for super table time sorting
# the maximum number of records allowed for super table time sorting
# maxNumOfOrderedRes 100000
# maxNumOfOrderedRes 100000
...
...
src/client/src/tscSQLParser.c
浏览文件 @
e87118e5
...
@@ -3218,7 +3218,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -3218,7 +3218,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
pCmd
->
command
=
TSDB_SQL_SHOW
;
pCmd
->
command
=
TSDB_SQL_SHOW
;
const
char
*
msg1
=
"invalid name"
;
const
char
*
msg1
=
"invalid name"
;
const
char
*
msg2
=
"
pattern filter string too long
"
;
const
char
*
msg2
=
"
wildcard string should be less than %d characters
"
;
const
char
*
msg3
=
"database name too long"
;
const
char
*
msg3
=
"database name too long"
;
const
char
*
msg4
=
"invalid ip address"
;
const
char
*
msg4
=
"invalid ip address"
;
const
char
*
msg5
=
"database name is empty"
;
const
char
*
msg5
=
"database name is empty"
;
...
@@ -3262,8 +3262,10 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -3262,8 +3262,10 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
}
}
if
(
!
tscValidateTableNameLength
(
pCmd
->
payloadLen
))
{
if
(
pPattern
->
n
>
tsMaxWildCardsLen
){
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
char
tmp
[
64
]
=
{
0
};
sprintf
(
tmp
,
msg2
,
tsMaxWildCardsLen
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
tmp
);
}
}
}
}
}
else
if
(
showType
==
TSDB_MGMT_TABLE_VNODES
)
{
}
else
if
(
showType
==
TSDB_MGMT_TABLE_VNODES
)
{
...
@@ -4394,15 +4396,17 @@ static int32_t validateNullExpr(tSqlExpr* pExpr, char* msgBuf) {
...
@@ -4394,15 +4396,17 @@ static int32_t validateNullExpr(tSqlExpr* pExpr, char* msgBuf) {
// check for like expression
// check for like expression
static
int32_t
validateLikeExpr
(
tSqlExpr
*
pExpr
,
STableMeta
*
pTableMeta
,
int32_t
index
,
char
*
msgBuf
)
{
static
int32_t
validateLikeExpr
(
tSqlExpr
*
pExpr
,
STableMeta
*
pTableMeta
,
int32_t
index
,
char
*
msgBuf
)
{
const
char
*
msg1
=
"wildcard string should be less than
20
characters"
;
const
char
*
msg1
=
"wildcard string should be less than
%d
characters"
;
const
char
*
msg2
=
"illegal column name"
;
const
char
*
msg2
=
"illegal column name"
;
tSqlExpr
*
pLeft
=
pExpr
->
pLeft
;
tSqlExpr
*
pLeft
=
pExpr
->
pLeft
;
tSqlExpr
*
pRight
=
pExpr
->
pRight
;
tSqlExpr
*
pRight
=
pExpr
->
pRight
;
if
(
pExpr
->
tokenId
==
TK_LIKE
)
{
if
(
pExpr
->
tokenId
==
TK_LIKE
)
{
if
(
pRight
->
value
.
nLen
>
TSDB_PATTERN_STRING_MAX_LEN
)
{
if
(
pRight
->
value
.
nLen
>
tsMaxWildCardsLen
)
{
return
invalidOperationMsg
(
msgBuf
,
msg1
);
char
tmp
[
64
]
=
{
0
};
sprintf
(
tmp
,
msg1
,
tsMaxWildCardsLen
);
return
invalidOperationMsg
(
msgBuf
,
tmp
);
}
}
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
...
...
src/common/inc/tglobal.h
浏览文件 @
e87118e5
...
@@ -70,6 +70,7 @@ extern int8_t tsKeepOriginalColumnName;
...
@@ -70,6 +70,7 @@ extern int8_t tsKeepOriginalColumnName;
// client
// client
extern
int32_t
tsMaxSQLStringLen
;
extern
int32_t
tsMaxSQLStringLen
;
extern
int32_t
tsMaxWildCardsLen
;
extern
int8_t
tsTscEnableRecordSql
;
extern
int8_t
tsTscEnableRecordSql
;
extern
int32_t
tsMaxNumOfOrderedResults
;
extern
int32_t
tsMaxNumOfOrderedResults
;
extern
int32_t
tsMinSlidingTime
;
extern
int32_t
tsMinSlidingTime
;
...
...
src/common/src/tglobal.c
浏览文件 @
e87118e5
...
@@ -25,6 +25,10 @@
...
@@ -25,6 +25,10 @@
#include "tutil.h"
#include "tutil.h"
#include "tlocale.h"
#include "tlocale.h"
#include "ttimezone.h"
#include "ttimezone.h"
#include "tcompare.h"
// TSDB
bool
tsdbForceKeepFile
=
false
;
// cluster
// cluster
char
tsFirst
[
TSDB_EP_LEN
]
=
{
0
};
char
tsFirst
[
TSDB_EP_LEN
]
=
{
0
};
...
@@ -75,6 +79,7 @@ int32_t tsCompressMsgSize = -1;
...
@@ -75,6 +79,7 @@ int32_t tsCompressMsgSize = -1;
// client
// client
int32_t
tsMaxSQLStringLen
=
TSDB_MAX_ALLOWED_SQL_LEN
;
int32_t
tsMaxSQLStringLen
=
TSDB_MAX_ALLOWED_SQL_LEN
;
int32_t
tsMaxWildCardsLen
=
TSDB_PATTERN_STRING_MAX_LEN
;
int8_t
tsTscEnableRecordSql
=
0
;
int8_t
tsTscEnableRecordSql
=
0
;
// the maximum number of results for projection query on super table that are returned from
// the maximum number of results for projection query on super table that are returned from
...
@@ -984,6 +989,16 @@ static void doInitGlobalConfig(void) {
...
@@ -984,6 +989,16 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"maxWildCardsLength"
;
cfg
.
ptr
=
&
tsMaxWildCardsLen
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
TSDB_MAX_FIELD_LEN
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"maxNumOfOrderedRes"
;
cfg
.
option
=
"maxNumOfOrderedRes"
;
cfg
.
ptr
=
&
tsMaxNumOfOrderedResults
;
cfg
.
ptr
=
&
tsMaxNumOfOrderedResults
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
...
@@ -1531,6 +1546,7 @@ static void doInitGlobalConfig(void) {
...
@@ -1531,6 +1546,7 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
assert
(
tsGlobalConfigNum
<=
TSDB_CFG_MAX_NUM
);
#ifdef TD_TSZ
#ifdef TD_TSZ
// lossy compress
// lossy compress
cfg
.
option
=
"lossyColumns"
;
cfg
.
option
=
"lossyColumns"
;
...
...
src/connector/nodejs/nodetaos/taosobjects.js
浏览文件 @
e87118e5
...
@@ -47,7 +47,8 @@ class TaosTimestamp extends Date {
...
@@ -47,7 +47,8 @@ class TaosTimestamp extends Date {
super
(
Math
.
floor
(
date
/
1000
));
super
(
Math
.
floor
(
date
/
1000
));
this
.
precisionExtras
=
date
%
1000
;
this
.
precisionExtras
=
date
%
1000
;
}
else
if
(
precision
===
2
)
{
}
else
if
(
precision
===
2
)
{
super
(
parseInt
(
date
/
1000000
));
// use BigInt to fix: 1623254400999999999 / 1000000 = 1623254401000 which not expected
super
(
parseInt
(
BigInt
(
date
)
/
1000000
n
));
// use BigInt to fix: 1625801548423914405 % 1000000 = 914496 which not expected (914405)
// use BigInt to fix: 1625801548423914405 % 1000000 = 914496 which not expected (914405)
this
.
precisionExtras
=
parseInt
(
BigInt
(
date
)
%
1000000
n
);
this
.
precisionExtras
=
parseInt
(
BigInt
(
date
)
%
1000000
n
);
}
else
{
}
else
{
...
...
src/connector/nodejs/package.json
浏览文件 @
e87118e5
{
{
"name"
:
"td2.0-connector"
,
"name"
:
"td2.0-connector"
,
"version"
:
"2.0.
9
"
,
"version"
:
"2.0.
10
"
,
"description"
:
"A Node.js connector for TDengine."
,
"description"
:
"A Node.js connector for TDengine."
,
"main"
:
"tdengine.js"
,
"main"
:
"tdengine.js"
,
"directories"
:
{
"directories"
:
{
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
e87118e5
...
@@ -166,7 +166,6 @@ int32_t dnodeInitSystem() {
...
@@ -166,7 +166,6 @@ int32_t dnodeInitSystem() {
taosInitGlobalCfg
();
taosInitGlobalCfg
();
taosReadGlobalLogCfg
();
taosReadGlobalLogCfg
();
taosSetCoreDump
();
taosSetCoreDump
();
taosInitNotes
();
dnodeInitTmr
();
dnodeInitTmr
();
if
(
dnodeCreateDir
(
tsLogDir
)
<
0
)
{
if
(
dnodeCreateDir
(
tsLogDir
)
<
0
)
{
...
@@ -188,6 +187,8 @@ int32_t dnodeInitSystem() {
...
@@ -188,6 +187,8 @@ int32_t dnodeInitSystem() {
dInfo
(
"start to initialize TDengine"
);
dInfo
(
"start to initialize TDengine"
);
taosInitNotes
();
if
(
dnodeInitComponents
()
!=
0
)
{
if
(
dnodeInitComponents
()
!=
0
)
{
return
-
1
;
return
-
1
;
}
}
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
e87118e5
...
@@ -77,7 +77,7 @@ extern char configDir[];
...
@@ -77,7 +77,7 @@ extern char configDir[];
#define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS)
#define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS)
#define MAX_USERNAME_SIZE 64
#define MAX_USERNAME_SIZE 64
#define MAX_PASSWORD_SIZE
64
#define MAX_PASSWORD_SIZE
16
#define MAX_HOSTNAME_SIZE 253 // https://man7.org/linux/man-pages/man7/hostname.7.html
#define MAX_HOSTNAME_SIZE 253 // https://man7.org/linux/man-pages/man7/hostname.7.html
#define MAX_TB_NAME_SIZE 64
#define MAX_TB_NAME_SIZE 64
#define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space
#define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space
...
@@ -216,7 +216,7 @@ typedef struct SArguments_S {
...
@@ -216,7 +216,7 @@ typedef struct SArguments_S {
uint16_t
port
;
uint16_t
port
;
uint16_t
iface
;
uint16_t
iface
;
char
*
user
;
char
*
user
;
char
*
password
;
char
password
[
MAX_PASSWORD_SIZE
]
;
char
*
database
;
char
*
database
;
int
replica
;
int
replica
;
char
*
tb_prefix
;
char
*
tb_prefix
;
...
@@ -709,24 +709,24 @@ static void printHelp() {
...
@@ -709,24 +709,24 @@ static void printHelp() {
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-u"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-u"
,
indent
,
"The TDengine user name to use when connecting to the server. Default is 'root'."
);
"The TDengine user name to use when connecting to the server. Default is 'root'."
);
#ifdef _TD_POWER_
#ifdef _TD_POWER_
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
P
"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
p
"
,
indent
,
"The password to use when connecting to the server. Default is 'powerdb'."
);
"The password to use when connecting to the server. Default is 'powerdb'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
"Configuration directory. Default is '/etc/power/'."
);
"Configuration directory. Default is '/etc/power/'."
);
#elif (_TD_TQ_ == true)
#elif (_TD_TQ_ == true)
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
P
"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
p
"
,
indent
,
"The password to use when connecting to the server. Default is 'tqueue'."
);
"The password to use when connecting to the server. Default is 'tqueue'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
"Configuration directory. Default is '/etc/tq/'."
);
"Configuration directory. Default is '/etc/tq/'."
);
#else
#else
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
P
"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
p
"
,
indent
,
"The password to use when connecting to the server. Default is 'taosdata'."
);
"The password to use when connecting to the server. Default is 'taosdata'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
"Configuration directory. Default is '/etc/taos/'."
);
"Configuration directory. Default is '/etc/taos/'."
);
#endif
#endif
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-h"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-h"
,
indent
,
"The host to connect to TDengine. Default is localhost."
);
"The host to connect to TDengine. Default is localhost."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
p
"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-
P
"
,
indent
,
"The TCP/IP port number to use for the connection. Default is 0."
);
"The TCP/IP port number to use for the connection. Default is 0."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-I"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-I"
,
indent
,
#if STMT_IFACE_ENABLED == 1
#if STMT_IFACE_ENABLED == 1
...
@@ -826,11 +826,11 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
...
@@ -826,11 +826,11 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
arguments
->
host
=
argv
[
++
i
];
arguments
->
host
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-
p
"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-
P
"
)
==
0
)
{
if
((
argc
==
i
+
1
)
||
if
((
argc
==
i
+
1
)
||
(
!
isStringNumber
(
argv
[
i
+
1
])))
{
(
!
isStringNumber
(
argv
[
i
+
1
])))
{
printHelp
();
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-
p
need a number following!
\n
"
);
errorPrint
(
"%s"
,
"
\n\t
-
P
need a number following!
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
arguments
->
port
=
atoi
(
argv
[
++
i
]);
arguments
->
port
=
atoi
(
argv
[
++
i
]);
...
@@ -860,13 +860,13 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
...
@@ -860,13 +860,13 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
arguments
->
user
=
argv
[
++
i
];
arguments
->
user
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-P"
)
==
0
)
{
}
else
if
(
strncmp
(
argv
[
i
],
"-p"
,
2
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
if
(
strlen
(
argv
[
i
])
==
2
)
{
printHelp
();
printf
(
"Enter password:"
);
errorPrint
(
"%s"
,
"
\n\t
-P need a valid string following!
\n
"
);
scanf
(
"%s"
,
arguments
->
password
);
exit
(
EXIT_FAILURE
);
}
else
{
tstrncpy
(
arguments
->
password
,
(
char
*
)(
argv
[
i
]
+
2
),
MAX_PASSWORD_SIZE
);
}
}
arguments
->
password
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-o"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-o"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
printHelp
();
...
@@ -1065,7 +1065,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
...
@@ -1065,7 +1065,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments
->
debug_print
=
true
;
arguments
->
debug_print
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-gg"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-gg"
)
==
0
)
{
arguments
->
verbose_print
=
true
;
arguments
->
verbose_print
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-
pp
"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-
PP
"
)
==
0
)
{
arguments
->
performance_print
=
true
;
arguments
->
performance_print
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-O"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-O"
)
==
0
)
{
if
((
argc
==
i
+
1
)
||
if
((
argc
==
i
+
1
)
||
...
@@ -2319,15 +2319,15 @@ static void printfDbInfoForQueryToFile(
...
@@ -2319,15 +2319,15 @@ static void printfDbInfoForQueryToFile(
}
}
static
void
printfQuerySystemInfo
(
TAOS
*
taos
)
{
static
void
printfQuerySystemInfo
(
TAOS
*
taos
)
{
char
filename
[
BUFFER_SIZE
+
1
]
=
{
0
};
char
filename
[
MAX_FILE_NAME_LEN
]
=
{
0
};
char
buffer
[
BUFFER_SIZE
+
1
]
=
{
0
};
char
buffer
[
1024
]
=
{
0
};
TAOS_RES
*
res
;
TAOS_RES
*
res
;
time_t
t
;
time_t
t
;
struct
tm
*
lt
;
struct
tm
*
lt
;
time
(
&
t
);
time
(
&
t
);
lt
=
localtime
(
&
t
);
lt
=
localtime
(
&
t
);
snprintf
(
filename
,
BUFFER_SIZE
,
"querySystemInfo-%d-%d-%d %d:%d:%d"
,
snprintf
(
filename
,
MAX_FILE_NAME_LEN
,
"querySystemInfo-%d-%d-%d %d:%d:%d"
,
lt
->
tm_year
+
1900
,
lt
->
tm_mon
,
lt
->
tm_mday
,
lt
->
tm_hour
,
lt
->
tm_min
,
lt
->
tm_year
+
1900
,
lt
->
tm_mon
,
lt
->
tm_mday
,
lt
->
tm_hour
,
lt
->
tm_min
,
lt
->
tm_sec
);
lt
->
tm_sec
);
...
@@ -2359,12 +2359,12 @@ static void printfQuerySystemInfo(TAOS * taos) {
...
@@ -2359,12 +2359,12 @@ static void printfQuerySystemInfo(TAOS * taos) {
printfDbInfoForQueryToFile
(
filename
,
dbInfos
[
i
],
i
);
printfDbInfoForQueryToFile
(
filename
,
dbInfos
[
i
],
i
);
// show db.vgroups
// show db.vgroups
snprintf
(
buffer
,
BUFFER_SIZE
,
"show %s.vgroups;"
,
dbInfos
[
i
]
->
name
);
snprintf
(
buffer
,
1024
,
"show %s.vgroups;"
,
dbInfos
[
i
]
->
name
);
res
=
taos_query
(
taos
,
buffer
);
res
=
taos_query
(
taos
,
buffer
);
xDumpResultToFile
(
filename
,
res
);
xDumpResultToFile
(
filename
,
res
);
// show db.stables
// show db.stables
snprintf
(
buffer
,
BUFFER_SIZE
,
"show %s.stables;"
,
dbInfos
[
i
]
->
name
);
snprintf
(
buffer
,
1024
,
"show %s.stables;"
,
dbInfos
[
i
]
->
name
);
res
=
taos_query
(
taos
,
buffer
);
res
=
taos_query
(
taos
,
buffer
);
xDumpResultToFile
(
filename
,
res
);
xDumpResultToFile
(
filename
,
res
);
free
(
dbInfos
[
i
]);
free
(
dbInfos
[
i
]);
...
@@ -2713,7 +2713,7 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
...
@@ -2713,7 +2713,7 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
char
*
dbName
,
char
*
sTblName
,
char
**
childTblNameOfSuperTbl
,
char
*
dbName
,
char
*
sTblName
,
char
**
childTblNameOfSuperTbl
,
int64_t
*
childTblCountOfSuperTbl
,
int64_t
limit
,
uint64_t
offset
)
{
int64_t
*
childTblCountOfSuperTbl
,
int64_t
limit
,
uint64_t
offset
)
{
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
command
[
1024
]
=
"
\0
"
;
char
limitBuf
[
100
]
=
"
\0
"
;
char
limitBuf
[
100
]
=
"
\0
"
;
TAOS_RES
*
res
;
TAOS_RES
*
res
;
...
@@ -2727,7 +2727,7 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
...
@@ -2727,7 +2727,7 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
}
}
//get all child table name use cmd: select tbname from superTblName;
//get all child table name use cmd: select tbname from superTblName;
snprintf
(
command
,
BUFFER_SIZE
,
"select tbname from %s.%s %s"
,
snprintf
(
command
,
1024
,
"select tbname from %s.%s %s"
,
dbName
,
sTblName
,
limitBuf
);
dbName
,
sTblName
,
limitBuf
);
res
=
taos_query
(
taos
,
command
);
res
=
taos_query
(
taos
,
command
);
...
@@ -2805,13 +2805,13 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName,
...
@@ -2805,13 +2805,13 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName,
static
int
getSuperTableFromServer
(
TAOS
*
taos
,
char
*
dbName
,
static
int
getSuperTableFromServer
(
TAOS
*
taos
,
char
*
dbName
,
SSuperTable
*
superTbls
)
{
SSuperTable
*
superTbls
)
{
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
command
[
1024
]
=
"
\0
"
;
TAOS_RES
*
res
;
TAOS_RES
*
res
;
TAOS_ROW
row
=
NULL
;
TAOS_ROW
row
=
NULL
;
int
count
=
0
;
int
count
=
0
;
//get schema use cmd: describe superTblName;
//get schema use cmd: describe superTblName;
snprintf
(
command
,
BUFFER_SIZE
,
"describe %s.%s"
,
dbName
,
superTbls
->
sTblName
);
snprintf
(
command
,
1024
,
"describe %s.%s"
,
dbName
,
superTbls
->
sTblName
);
res
=
taos_query
(
taos
,
command
);
res
=
taos_query
(
taos
,
command
);
int32_t
code
=
taos_errno
(
res
);
int32_t
code
=
taos_errno
(
res
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
...
@@ -2891,7 +2891,8 @@ static int createSuperTable(
...
@@ -2891,7 +2891,8 @@ static int createSuperTable(
TAOS
*
taos
,
char
*
dbName
,
TAOS
*
taos
,
char
*
dbName
,
SSuperTable
*
superTbl
)
{
SSuperTable
*
superTbl
)
{
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
*
command
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
command
);
char
cols
[
COL_BUFFER_LEN
]
=
"
\0
"
;
char
cols
[
COL_BUFFER_LEN
]
=
"
\0
"
;
int
colIndex
;
int
colIndex
;
...
@@ -2902,6 +2903,7 @@ static int createSuperTable(
...
@@ -2902,6 +2903,7 @@ static int createSuperTable(
if
(
superTbl
->
columnCount
==
0
)
{
if
(
superTbl
->
columnCount
==
0
)
{
errorPrint
(
"%s() LN%d, super table column count is %d
\n
"
,
errorPrint
(
"%s() LN%d, super table column count is %d
\n
"
,
__func__
,
__LINE__
,
superTbl
->
columnCount
);
__func__
,
__LINE__
,
superTbl
->
columnCount
);
free
(
command
);
return
-
1
;
return
-
1
;
}
}
...
@@ -2964,6 +2966,7 @@ static int createSuperTable(
...
@@ -2964,6 +2966,7 @@ static int createSuperTable(
taos_close
(
taos
);
taos_close
(
taos
);
errorPrint
(
"%s() LN%d, config error data type : %s
\n
"
,
errorPrint
(
"%s() LN%d, config error data type : %s
\n
"
,
__func__
,
__LINE__
,
dataType
);
__func__
,
__LINE__
,
dataType
);
free
(
command
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
}
...
@@ -2976,6 +2979,7 @@ static int createSuperTable(
...
@@ -2976,6 +2979,7 @@ static int createSuperTable(
errorPrint
(
"%s() LN%d, Failed when calloc, size:%d"
,
errorPrint
(
"%s() LN%d, Failed when calloc, size:%d"
,
__func__
,
__LINE__
,
len
+
1
);
__func__
,
__LINE__
,
len
+
1
);
taos_close
(
taos
);
taos_close
(
taos
);
free
(
command
);
exit
(
-
1
);
exit
(
-
1
);
}
}
...
@@ -2986,6 +2990,7 @@ static int createSuperTable(
...
@@ -2986,6 +2990,7 @@ static int createSuperTable(
if
(
superTbl
->
tagCount
==
0
)
{
if
(
superTbl
->
tagCount
==
0
)
{
errorPrint
(
"%s() LN%d, super table tag count is %d
\n
"
,
errorPrint
(
"%s() LN%d, super table tag count is %d
\n
"
,
__func__
,
__LINE__
,
superTbl
->
tagCount
);
__func__
,
__LINE__
,
superTbl
->
tagCount
);
free
(
command
);
return
-
1
;
return
-
1
;
}
}
...
@@ -3051,6 +3056,7 @@ static int createSuperTable(
...
@@ -3051,6 +3056,7 @@ static int createSuperTable(
taos_close
(
taos
);
taos_close
(
taos
);
errorPrint
(
"%s() LN%d, config error tag type : %s
\n
"
,
errorPrint
(
"%s() LN%d, config error tag type : %s
\n
"
,
__func__
,
__LINE__
,
dataType
);
__func__
,
__LINE__
,
dataType
);
free
(
command
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
}
...
@@ -3066,13 +3072,16 @@ static int createSuperTable(
...
@@ -3066,13 +3072,16 @@ static int createSuperTable(
if
(
0
!=
queryDbExec
(
taos
,
command
,
NO_INSERT_TYPE
,
false
))
{
if
(
0
!=
queryDbExec
(
taos
,
command
,
NO_INSERT_TYPE
,
false
))
{
errorPrint
(
"create supertable %s failed!
\n\n
"
,
errorPrint
(
"create supertable %s failed!
\n\n
"
,
superTbl
->
sTblName
);
superTbl
->
sTblName
);
free
(
command
);
return
-
1
;
return
-
1
;
}
}
debugPrint
(
"create supertable %s success!
\n\n
"
,
superTbl
->
sTblName
);
debugPrint
(
"create supertable %s success!
\n\n
"
,
superTbl
->
sTblName
);
free
(
command
);
return
0
;
return
0
;
}
}
static
int
createDatabasesAndStables
(
)
{
int
createDatabasesAndStables
(
char
*
command
)
{
TAOS
*
taos
=
NULL
;
TAOS
*
taos
=
NULL
;
int
ret
=
0
;
int
ret
=
0
;
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
NULL
,
g_Dbs
.
port
);
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
NULL
,
g_Dbs
.
port
);
...
@@ -3080,8 +3089,7 @@ static int createDatabasesAndStables() {
...
@@ -3080,8 +3089,7 @@ static int createDatabasesAndStables() {
errorPrint
(
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
errorPrint
(
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
return
-
1
;
return
-
1
;
}
}
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
if
(
g_Dbs
.
db
[
i
].
drop
)
{
if
(
g_Dbs
.
db
[
i
].
drop
)
{
sprintf
(
command
,
"drop database if exists %s;"
,
g_Dbs
.
db
[
i
].
dbName
);
sprintf
(
command
,
"drop database if exists %s;"
,
g_Dbs
.
db
[
i
].
dbName
);
...
@@ -7145,7 +7153,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7145,7 +7153,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
exit
(
-
1
);
exit
(
-
1
);
}
}
char
buffer
[
BUFFER_SIZE
];
char
*
buffer
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
buffer
);
char
*
pstr
=
buffer
;
char
*
pstr
=
buffer
;
if
((
superTblInfo
)
if
((
superTblInfo
)
...
@@ -7174,8 +7183,11 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7174,8 +7183,11 @@ static void startMultiThreadInsertData(int threads, char* db_name,
ret
,
taos_stmt_errstr
(
pThreadInfo
->
stmt
));
ret
,
taos_stmt_errstr
(
pThreadInfo
->
stmt
));
free
(
pids
);
free
(
pids
);
free
(
infos
);
free
(
infos
);
free
(
buffer
);
exit
(
-
1
);
exit
(
-
1
);
}
}
free
(
buffer
);
}
}
#endif
#endif
}
else
{
}
else
{
...
@@ -7310,12 +7322,15 @@ static void *readTable(void *sarg) {
...
@@ -7310,12 +7322,15 @@ static void *readTable(void *sarg) {
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
setThreadName
(
"readTable"
);
setThreadName
(
"readTable"
);
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
*
command
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
command
);
uint64_t
sTime
=
pThreadInfo
->
start_time
;
uint64_t
sTime
=
pThreadInfo
->
start_time
;
char
*
tb_prefix
=
pThreadInfo
->
tb_prefix
;
char
*
tb_prefix
=
pThreadInfo
->
tb_prefix
;
FILE
*
fp
=
fopen
(
pThreadInfo
->
filePath
,
"a"
);
FILE
*
fp
=
fopen
(
pThreadInfo
->
filePath
,
"a"
);
if
(
NULL
==
fp
)
{
if
(
NULL
==
fp
)
{
errorPrint
(
"fopen %s fail, reason:%s.
\n
"
,
pThreadInfo
->
filePath
,
strerror
(
errno
));
errorPrint
(
"fopen %s fail, reason:%s.
\n
"
,
pThreadInfo
->
filePath
,
strerror
(
errno
));
free
(
command
);
return
NULL
;
return
NULL
;
}
}
...
@@ -7354,6 +7369,7 @@ static void *readTable(void *sarg) {
...
@@ -7354,6 +7369,7 @@ static void *readTable(void *sarg) {
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
taos_close
(
taos
);
taos_close
(
taos
);
fclose
(
fp
);
fclose
(
fp
);
free
(
command
);
return
NULL
;
return
NULL
;
}
}
...
@@ -7374,6 +7390,7 @@ static void *readTable(void *sarg) {
...
@@ -7374,6 +7390,7 @@ static void *readTable(void *sarg) {
}
}
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"
\n
"
);
fclose
(
fp
);
fclose
(
fp
);
free
(
command
);
#endif
#endif
return
NULL
;
return
NULL
;
}
}
...
@@ -7383,10 +7400,13 @@ static void *readMetric(void *sarg) {
...
@@ -7383,10 +7400,13 @@ static void *readMetric(void *sarg) {
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
setThreadName
(
"readMetric"
);
setThreadName
(
"readMetric"
);
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
*
command
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
command
);
FILE
*
fp
=
fopen
(
pThreadInfo
->
filePath
,
"a"
);
FILE
*
fp
=
fopen
(
pThreadInfo
->
filePath
,
"a"
);
if
(
NULL
==
fp
)
{
if
(
NULL
==
fp
)
{
printf
(
"fopen %s fail, reason:%s.
\n
"
,
pThreadInfo
->
filePath
,
strerror
(
errno
));
printf
(
"fopen %s fail, reason:%s.
\n
"
,
pThreadInfo
->
filePath
,
strerror
(
errno
));
free
(
command
);
return
NULL
;
return
NULL
;
}
}
...
@@ -7431,6 +7451,7 @@ static void *readMetric(void *sarg) {
...
@@ -7431,6 +7451,7 @@ static void *readMetric(void *sarg) {
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
taos_close
(
taos
);
taos_close
(
taos
);
fclose
(
fp
);
fclose
(
fp
);
free
(
command
);
return
NULL
;
return
NULL
;
}
}
int
count
=
0
;
int
count
=
0
;
...
@@ -7448,6 +7469,7 @@ static void *readMetric(void *sarg) {
...
@@ -7448,6 +7469,7 @@ static void *readMetric(void *sarg) {
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"
\n
"
);
}
}
fclose
(
fp
);
fclose
(
fp
);
free
(
command
);
#endif
#endif
return
NULL
;
return
NULL
;
}
}
...
@@ -7484,11 +7506,16 @@ static int insertTestProcess() {
...
@@ -7484,11 +7506,16 @@ static int insertTestProcess() {
init_rand_data
();
init_rand_data
();
// create database and super tables
// create database and super tables
if
(
createDatabasesAndStables
()
!=
0
)
{
char
*
cmdBuffer
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
cmdBuffer
);
if
(
createDatabasesAndStables
(
cmdBuffer
)
!=
0
)
{
if
(
g_fpOfInsertResult
)
if
(
g_fpOfInsertResult
)
fclose
(
g_fpOfInsertResult
);
fclose
(
g_fpOfInsertResult
);
free
(
cmdBuffer
);
return
-
1
;
return
-
1
;
}
}
free
(
cmdBuffer
);
// pretreatement
// pretreatement
if
(
prepareSampleData
()
!=
0
)
{
if
(
prepareSampleData
()
!=
0
)
{
...
@@ -7657,7 +7684,9 @@ static void replaceChildTblName(char* inSql, char* outSql, int tblIndex) {
...
@@ -7657,7 +7684,9 @@ static void replaceChildTblName(char* inSql, char* outSql, int tblIndex) {
}
}
static
void
*
superTableQuery
(
void
*
sarg
)
{
static
void
*
superTableQuery
(
void
*
sarg
)
{
char
sqlstr
[
BUFFER_SIZE
];
char
*
sqlstr
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
sqlstr
);
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
setThreadName
(
"superTableQuery"
);
setThreadName
(
"superTableQuery"
);
...
@@ -7672,6 +7701,7 @@ static void *superTableQuery(void *sarg) {
...
@@ -7672,6 +7701,7 @@ static void *superTableQuery(void *sarg) {
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
errorPrint
(
"[%d] Failed to connect to TDengine, reason:%s
\n
"
,
errorPrint
(
"[%d] Failed to connect to TDengine, reason:%s
\n
"
,
pThreadInfo
->
threadID
,
taos_errstr
(
NULL
));
pThreadInfo
->
threadID
,
taos_errstr
(
NULL
));
free
(
sqlstr
);
return
NULL
;
return
NULL
;
}
else
{
}
else
{
pThreadInfo
->
taos
=
taos
;
pThreadInfo
->
taos
=
taos
;
...
@@ -7696,7 +7726,7 @@ static void *superTableQuery(void *sarg) {
...
@@ -7696,7 +7726,7 @@ static void *superTableQuery(void *sarg) {
st
=
taosGetTimestampMs
();
st
=
taosGetTimestampMs
();
for
(
int
i
=
pThreadInfo
->
start_table_from
;
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
for
(
int
i
=
pThreadInfo
->
start_table_from
;
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
for
(
int
j
=
0
;
j
<
g_queryInfo
.
superQueryInfo
.
sqlCount
;
j
++
)
{
for
(
int
j
=
0
;
j
<
g_queryInfo
.
superQueryInfo
.
sqlCount
;
j
++
)
{
memset
(
sqlstr
,
0
,
sizeof
(
sqlstr
)
);
memset
(
sqlstr
,
0
,
BUFFER_SIZE
);
replaceChildTblName
(
g_queryInfo
.
superQueryInfo
.
sql
[
j
],
sqlstr
,
i
);
replaceChildTblName
(
g_queryInfo
.
superQueryInfo
.
sql
[
j
],
sqlstr
,
i
);
if
(
g_queryInfo
.
superQueryInfo
.
result
[
j
][
0
]
!=
'\0'
)
{
if
(
g_queryInfo
.
superQueryInfo
.
result
[
j
][
0
]
!=
'\0'
)
{
sprintf
(
pThreadInfo
->
filePath
,
"%s-%d"
,
sprintf
(
pThreadInfo
->
filePath
,
"%s-%d"
,
...
@@ -7727,6 +7757,7 @@ static void *superTableQuery(void *sarg) {
...
@@ -7727,6 +7757,7 @@ static void *superTableQuery(void *sarg) {
(
double
)(
et
-
st
)
/
1000
.
0
);
(
double
)(
et
-
st
)
/
1000
.
0
);
}
}
free
(
sqlstr
);
return
NULL
;
return
NULL
;
}
}
...
@@ -7960,7 +7991,9 @@ static TAOS_SUB* subscribeImpl(
...
@@ -7960,7 +7991,9 @@ static TAOS_SUB* subscribeImpl(
static
void
*
superSubscribe
(
void
*
sarg
)
{
static
void
*
superSubscribe
(
void
*
sarg
)
{
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
char
subSqlstr
[
BUFFER_SIZE
];
char
*
subSqlStr
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
subSqlStr
);
TAOS_SUB
*
tsub
[
MAX_QUERY_SQL_COUNT
]
=
{
0
};
TAOS_SUB
*
tsub
[
MAX_QUERY_SQL_COUNT
]
=
{
0
};
uint64_t
tsubSeq
;
uint64_t
tsubSeq
;
...
@@ -7969,6 +8002,7 @@ static void *superSubscribe(void *sarg) {
...
@@ -7969,6 +8002,7 @@ static void *superSubscribe(void *sarg) {
if
(
pThreadInfo
->
ntables
>
MAX_QUERY_SQL_COUNT
)
{
if
(
pThreadInfo
->
ntables
>
MAX_QUERY_SQL_COUNT
)
{
errorPrint
(
"The table number(%"
PRId64
") of the thread is more than max query sql count: %d
\n
"
,
errorPrint
(
"The table number(%"
PRId64
") of the thread is more than max query sql count: %d
\n
"
,
pThreadInfo
->
ntables
,
MAX_QUERY_SQL_COUNT
);
pThreadInfo
->
ntables
,
MAX_QUERY_SQL_COUNT
);
free
(
subSqlStr
);
exit
(
-
1
);
exit
(
-
1
);
}
}
...
@@ -7981,6 +8015,7 @@ static void *superSubscribe(void *sarg) {
...
@@ -7981,6 +8015,7 @@ static void *superSubscribe(void *sarg) {
if
(
pThreadInfo
->
taos
==
NULL
)
{
if
(
pThreadInfo
->
taos
==
NULL
)
{
errorPrint
(
"[%d] Failed to connect to TDengine, reason:%s
\n
"
,
errorPrint
(
"[%d] Failed to connect to TDengine, reason:%s
\n
"
,
pThreadInfo
->
threadID
,
taos_errstr
(
NULL
));
pThreadInfo
->
threadID
,
taos_errstr
(
NULL
));
free
(
subSqlStr
);
return
NULL
;
return
NULL
;
}
}
}
}
...
@@ -7991,6 +8026,7 @@ static void *superSubscribe(void *sarg) {
...
@@ -7991,6 +8026,7 @@ static void *superSubscribe(void *sarg) {
taos_close
(
pThreadInfo
->
taos
);
taos_close
(
pThreadInfo
->
taos
);
errorPrint
(
"use database %s failed!
\n\n
"
,
errorPrint
(
"use database %s failed!
\n\n
"
,
g_queryInfo
.
dbName
);
g_queryInfo
.
dbName
);
free
(
subSqlStr
);
return
NULL
;
return
NULL
;
}
}
...
@@ -8005,25 +8041,26 @@ static void *superSubscribe(void *sarg) {
...
@@ -8005,25 +8041,26 @@ static void *superSubscribe(void *sarg) {
pThreadInfo
->
end_table_to
,
i
);
pThreadInfo
->
end_table_to
,
i
);
sprintf
(
topic
,
"taosdemo-subscribe-%"
PRIu64
"-%"
PRIu64
""
,
sprintf
(
topic
,
"taosdemo-subscribe-%"
PRIu64
"-%"
PRIu64
""
,
i
,
pThreadInfo
->
querySeq
);
i
,
pThreadInfo
->
querySeq
);
memset
(
subSql
str
,
0
,
sizeof
(
subSqlstr
)
);
memset
(
subSql
Str
,
0
,
BUFFER_SIZE
);
replaceChildTblName
(
replaceChildTblName
(
g_queryInfo
.
superQueryInfo
.
sql
[
pThreadInfo
->
querySeq
],
g_queryInfo
.
superQueryInfo
.
sql
[
pThreadInfo
->
querySeq
],
subSql
s
tr
,
i
);
subSql
S
tr
,
i
);
if
(
g_queryInfo
.
superQueryInfo
.
result
[
pThreadInfo
->
querySeq
][
0
]
!=
0
)
{
if
(
g_queryInfo
.
superQueryInfo
.
result
[
pThreadInfo
->
querySeq
][
0
]
!=
0
)
{
sprintf
(
pThreadInfo
->
filePath
,
"%s-%d"
,
sprintf
(
pThreadInfo
->
filePath
,
"%s-%d"
,
g_queryInfo
.
superQueryInfo
.
result
[
pThreadInfo
->
querySeq
],
g_queryInfo
.
superQueryInfo
.
result
[
pThreadInfo
->
querySeq
],
pThreadInfo
->
threadID
);
pThreadInfo
->
threadID
);
}
}
verbosePrint
(
"%s() LN%d, [%d] subSql
s
tr: %s
\n
"
,
verbosePrint
(
"%s() LN%d, [%d] subSql
S
tr: %s
\n
"
,
__func__
,
__LINE__
,
pThreadInfo
->
threadID
,
subSql
s
tr
);
__func__
,
__LINE__
,
pThreadInfo
->
threadID
,
subSql
S
tr
);
tsub
[
tsubSeq
]
=
subscribeImpl
(
tsub
[
tsubSeq
]
=
subscribeImpl
(
STABLE_CLASS
,
STABLE_CLASS
,
pThreadInfo
,
subSql
s
tr
,
topic
,
pThreadInfo
,
subSql
S
tr
,
topic
,
g_queryInfo
.
superQueryInfo
.
subscribeRestart
,
g_queryInfo
.
superQueryInfo
.
subscribeRestart
,
g_queryInfo
.
superQueryInfo
.
subscribeInterval
);
g_queryInfo
.
superQueryInfo
.
subscribeInterval
);
if
(
NULL
==
tsub
[
tsubSeq
])
{
if
(
NULL
==
tsub
[
tsubSeq
])
{
taos_close
(
pThreadInfo
->
taos
);
taos_close
(
pThreadInfo
->
taos
);
free
(
subSqlStr
);
return
NULL
;
return
NULL
;
}
}
}
}
...
@@ -8080,12 +8117,13 @@ static void *superSubscribe(void *sarg) {
...
@@ -8080,12 +8117,13 @@ static void *superSubscribe(void *sarg) {
consumed
[
tsubSeq
]
=
0
;
consumed
[
tsubSeq
]
=
0
;
tsub
[
tsubSeq
]
=
subscribeImpl
(
tsub
[
tsubSeq
]
=
subscribeImpl
(
STABLE_CLASS
,
STABLE_CLASS
,
pThreadInfo
,
subSql
s
tr
,
topic
,
pThreadInfo
,
subSql
S
tr
,
topic
,
g_queryInfo
.
superQueryInfo
.
subscribeRestart
,
g_queryInfo
.
superQueryInfo
.
subscribeRestart
,
g_queryInfo
.
superQueryInfo
.
subscribeInterval
g_queryInfo
.
superQueryInfo
.
subscribeInterval
);
);
if
(
NULL
==
tsub
[
tsubSeq
])
{
if
(
NULL
==
tsub
[
tsubSeq
])
{
taos_close
(
pThreadInfo
->
taos
);
taos_close
(
pThreadInfo
->
taos
);
free
(
subSqlStr
);
return
NULL
;
return
NULL
;
}
}
}
}
...
@@ -8105,6 +8143,7 @@ static void *superSubscribe(void *sarg) {
...
@@ -8105,6 +8143,7 @@ static void *superSubscribe(void *sarg) {
}
}
taos_close
(
pThreadInfo
->
taos
);
taos_close
(
pThreadInfo
->
taos
);
free
(
subSqlStr
);
return
NULL
;
return
NULL
;
}
}
...
@@ -8407,9 +8446,7 @@ static void setParaFromArg() {
...
@@ -8407,9 +8446,7 @@ static void setParaFromArg() {
tstrncpy
(
g_Dbs
.
user
,
g_args
.
user
,
MAX_USERNAME_SIZE
);
tstrncpy
(
g_Dbs
.
user
,
g_args
.
user
,
MAX_USERNAME_SIZE
);
}
}
if
(
g_args
.
password
)
{
tstrncpy
(
g_Dbs
.
password
,
g_args
.
password
,
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_Dbs
.
password
,
g_args
.
password
,
MAX_PASSWORD_SIZE
);
}
if
(
g_args
.
port
)
{
if
(
g_args
.
port
)
{
g_Dbs
.
port
=
g_args
.
port
;
g_Dbs
.
port
=
g_args
.
port
;
...
...
src/kit/taospack/taospack.c
浏览文件 @
e87118e5
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#if defined(WINDOWS)
#if defined(WINDOWS)
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
printf
(
"welcome to use taospack tools v1.3 for windows.
\n
"
);
printf
(
"welcome to use taospack tools v1.3 for windows.
\n
"
);
...
@@ -601,7 +602,6 @@ void test_threadsafe_double(int thread_count){
...
@@ -601,7 +602,6 @@ void test_threadsafe_double(int thread_count){
}
}
void
unitTestFloat
()
{
void
unitTestFloat
()
{
float
ft1
[]
=
{
1
.
11
,
2
.
22
,
3
.
333
};
float
ft1
[]
=
{
1
.
11
,
2
.
22
,
3
.
333
};
...
@@ -662,7 +662,50 @@ void unitTestFloat() {
...
@@ -662,7 +662,50 @@ void unitTestFloat() {
free
(
ft2
);
free
(
ft2
);
free
(
buff
);
free
(
buff
);
free
(
output
);
free
(
output
);
}
void
leakFloat
()
{
int
cnt
=
sizeof
(
g_ft1
)
/
sizeof
(
float
);
float
*
floats
=
g_ft1
;
int
algorithm
=
2
;
// compress
const
char
*
input
=
(
const
char
*
)
floats
;
int
input_len
=
cnt
*
sizeof
(
float
);
int
output_len
=
input_len
+
1024
;
char
*
output
=
(
char
*
)
malloc
(
output_len
);
char
*
buff
=
(
char
*
)
malloc
(
input_len
);
int
buff_len
=
input_len
;
int
ret_len
=
0
;
ret_len
=
tsCompressFloatLossy
(
input
,
input_len
,
cnt
,
output
,
output_len
,
algorithm
,
buff
,
buff_len
);
if
(
ret_len
==
0
)
{
printf
(
" compress float error.
\n
"
);
free
(
buff
);
free
(
output
);
return
;
}
float
*
ft2
=
(
float
*
)
malloc
(
input_len
);
ret_len
=
tsDecompressFloatLossy
(
output
,
ret_len
,
cnt
,
(
char
*
)
ft2
,
input_len
,
algorithm
,
buff
,
buff_len
);
if
(
ret_len
==
0
)
{
printf
(
" decompress float error.
\n
"
);
}
free
(
ft2
);
free
(
buff
);
free
(
output
);
}
void
leakTest
(){
for
(
int
i
=
0
;
i
<
90000000000000
;
i
++
){
if
(
i
%
10000
==
0
)
printf
(
" ---------- %d ----------------
\n
"
,
i
);
leakFloat
();
}
}
}
#define DB_CNT 500
#define DB_CNT 500
...
@@ -689,7 +732,7 @@ extern char Compressor [];
...
@@ -689,7 +732,7 @@ extern char Compressor [];
// ----------------- main ----------------------
// ----------------- main ----------------------
//
//
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
printf
(
"welcome to use taospack tools v1.
3
\n
"
);
printf
(
"welcome to use taospack tools v1.
6
\n
"
);
//printf(" sizeof(int)=%d\n", (int)sizeof(int));
//printf(" sizeof(int)=%d\n", (int)sizeof(int));
//printf(" sizeof(long)=%d\n", (int)sizeof(long));
//printf(" sizeof(long)=%d\n", (int)sizeof(long));
...
@@ -753,6 +796,9 @@ int main(int argc, char *argv[]) {
...
@@ -753,6 +796,9 @@ int main(int argc, char *argv[]) {
if
(
strcmp
(
argv
[
1
],
"-mem"
)
==
0
)
{
if
(
strcmp
(
argv
[
1
],
"-mem"
)
==
0
)
{
memTest
();
memTest
();
}
}
else
if
(
strcmp
(
argv
[
1
],
"-leak"
)
==
0
)
{
leakTest
();
}
}
}
else
{
else
{
unitTestFloat
();
unitTestFloat
();
...
...
src/query/src/qAggMain.c
浏览文件 @
e87118e5
...
@@ -4062,12 +4062,15 @@ static void mergeTableBlockDist(SResultRowCellInfo* pResInfo, const STableBlockD
...
@@ -4062,12 +4062,15 @@ static void mergeTableBlockDist(SResultRowCellInfo* pResInfo, const STableBlockD
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
int32_t
numSteps
=
tsMaxRowsInFileBlock
/
TSDB_BLOCK_DIST_STEP_ROWS
;
int32_t
maxSteps
=
TSDB_MAX_MAX_ROW_FBLOCK
/
TSDB_BLOCK_DIST_STEP_ROWS
;
pDist
->
dataBlockInfos
=
taosArrayInit
(
numSteps
,
sizeof
(
SFileBlockInfo
));
if
(
TSDB_MAX_MAX_ROW_FBLOCK
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
taosArraySetSize
(
pDist
->
dataBlockInfos
,
numSteps
);
++
maxSteps
;
}
pDist
->
dataBlockInfos
=
taosArrayInit
(
maxSteps
,
sizeof
(
SFileBlockInfo
));
taosArraySetSize
(
pDist
->
dataBlockInfos
,
maxSteps
);
}
}
size_t
steps
=
taosArrayGetSize
(
p
Dist
->
dataBlockInfos
);
size_t
steps
=
taosArrayGetSize
(
p
Src
->
dataBlockInfos
);
for
(
int32_t
i
=
0
;
i
<
steps
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
steps
;
++
i
)
{
int32_t
srcNumBlocks
=
((
SFileBlockInfo
*
)
taosArrayGet
(
pSrc
->
dataBlockInfos
,
i
))
->
numBlocksOfStep
;
int32_t
srcNumBlocks
=
((
SFileBlockInfo
*
)
taosArrayGet
(
pSrc
->
dataBlockInfos
,
i
))
->
numBlocksOfStep
;
SFileBlockInfo
*
blockInfo
=
(
SFileBlockInfo
*
)
taosArrayGet
(
pDist
->
dataBlockInfos
,
i
);
SFileBlockInfo
*
blockInfo
=
(
SFileBlockInfo
*
)
taosArrayGet
(
pDist
->
dataBlockInfos
,
i
);
...
...
src/query/src/qExecutor.c
浏览文件 @
e87118e5
...
@@ -5028,6 +5028,9 @@ static SSDataBlock* doBlockInfoScan(void* param, bool* newgroup) {
...
@@ -5028,6 +5028,9 @@ static SSDataBlock* doBlockInfoScan(void* param, bool* newgroup) {
tableBlockDist
.
numOfTables
=
(
int32_t
)
pOperator
->
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
;
tableBlockDist
.
numOfTables
=
(
int32_t
)
pOperator
->
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
;
int32_t
numRowSteps
=
tsMaxRowsInFileBlock
/
TSDB_BLOCK_DIST_STEP_ROWS
;
int32_t
numRowSteps
=
tsMaxRowsInFileBlock
/
TSDB_BLOCK_DIST_STEP_ROWS
;
if
(
tsMaxRowsInFileBlock
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
++
numRowSteps
;
}
tableBlockDist
.
dataBlockInfos
=
taosArrayInit
(
numRowSteps
,
sizeof
(
SFileBlockInfo
));
tableBlockDist
.
dataBlockInfos
=
taosArrayInit
(
numRowSteps
,
sizeof
(
SFileBlockInfo
));
taosArraySetSize
(
tableBlockDist
.
dataBlockInfos
,
numRowSteps
);
taosArraySetSize
(
tableBlockDist
.
dataBlockInfos
,
numRowSteps
);
tableBlockDist
.
maxRows
=
INT_MIN
;
tableBlockDist
.
maxRows
=
INT_MIN
;
...
...
src/tsdb/inc/tsdbFS.h
浏览文件 @
e87118e5
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
#define TSDB_FS_VERSION 0
#define TSDB_FS_VERSION 0
// ================== TSDB global config
extern
bool
tsdbForceKeepFile
;
// ================== CURRENT file header info
// ================== CURRENT file header info
typedef
struct
{
typedef
struct
{
uint32_t
version
;
// Current file system version (relating to code)
uint32_t
version
;
// Current file system version (relating to code)
...
@@ -109,4 +112,4 @@ static FORCE_INLINE int tsdbUnLockFS(STsdbFS* pFs) {
...
@@ -109,4 +112,4 @@ static FORCE_INLINE int tsdbUnLockFS(STsdbFS* pFs) {
return
0
;
return
0
;
}
}
#endif
/* _TD_TSDB_FS_H_ */
#endif
/* _TD_TSDB_FS_H_ */
\ No newline at end of file
src/tsdb/src/tsdbFS.c
浏览文件 @
e87118e5
...
@@ -38,7 +38,6 @@ static int tsdbProcessExpiredFS(STsdbRepo *pRepo);
...
@@ -38,7 +38,6 @@ static int tsdbProcessExpiredFS(STsdbRepo *pRepo);
static
int
tsdbCreateMeta
(
STsdbRepo
*
pRepo
);
static
int
tsdbCreateMeta
(
STsdbRepo
*
pRepo
);
// For backward compatibility
// For backward compatibility
bool
tsdbForceKeepFile
=
false
;
// ================== CURRENT file header info
// ================== CURRENT file header info
static
int
tsdbEncodeFSHeader
(
void
**
buf
,
SFSHeader
*
pHeader
)
{
static
int
tsdbEncodeFSHeader
(
void
**
buf
,
SFSHeader
*
pHeader
)
{
int
tlen
=
0
;
int
tlen
=
0
;
...
@@ -1354,4 +1353,4 @@ static void tsdbScanAndTryFixDFilesHeader(STsdbRepo *pRepo, int32_t *nExpired) {
...
@@ -1354,4 +1353,4 @@ static void tsdbScanAndTryFixDFilesHeader(STsdbRepo *pRepo, int32_t *nExpired) {
tsdbCloseDFileSet
(
&
fset
);
tsdbCloseDFileSet
(
&
fset
);
}
}
}
}
\ No newline at end of file
src/tsdb/src/tsdbRead.c
浏览文件 @
e87118e5
...
@@ -691,6 +691,18 @@ static STableGroupInfo* trimTableGroup(STimeWindow* window, STableGroupInfo* pGr
...
@@ -691,6 +691,18 @@ static STableGroupInfo* trimTableGroup(STimeWindow* window, STableGroupInfo* pGr
TsdbQueryHandleT
tsdbQueryRowsInExternalWindow
(
STsdbRepo
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
SMemRef
*
pRef
)
{
TsdbQueryHandleT
tsdbQueryRowsInExternalWindow
(
STsdbRepo
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
SMemRef
*
pRef
)
{
STableGroupInfo
*
pNew
=
trimTableGroup
(
&
pCond
->
twindow
,
groupList
);
STableGroupInfo
*
pNew
=
trimTableGroup
(
&
pCond
->
twindow
,
groupList
);
if
(
pNew
->
numOfTables
==
0
)
{
tsdbDebug
(
"update query time range to invalidate time window"
);
assert
(
taosArrayGetSize
(
pNew
->
pGroupList
)
==
0
);
bool
asc
=
ASCENDING_TRAVERSE
(
pCond
->
order
);
if
(
asc
)
{
pCond
->
twindow
.
ekey
=
pCond
->
twindow
.
skey
-
1
;
}
else
{
pCond
->
twindow
.
skey
=
pCond
->
twindow
.
ekey
-
1
;
}
}
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
pNew
,
qId
,
pRef
);
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
pNew
,
qId
,
pRef
);
pQueryHandle
->
loadExternalRow
=
true
;
pQueryHandle
->
loadExternalRow
=
true
;
pQueryHandle
->
currentLoadExternalRows
=
true
;
pQueryHandle
->
currentLoadExternalRows
=
true
;
...
...
src/util/inc/tcompare.h
浏览文件 @
e87118e5
...
@@ -25,7 +25,7 @@ extern "C" {
...
@@ -25,7 +25,7 @@ extern "C" {
#define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_NOMATCH 1
#define TSDB_PATTERN_NOMATCH 1
#define TSDB_PATTERN_NOWILDCARDMATCH 2
#define TSDB_PATTERN_NOWILDCARDMATCH 2
#define TSDB_PATTERN_STRING_MAX_LEN
2
0
#define TSDB_PATTERN_STRING_MAX_LEN
10
0
#define FLT_COMPAR_TOL_FACTOR 4
#define FLT_COMPAR_TOL_FACTOR 4
#define FLT_EQUAL(_x, _y) (fabs((_x) - (_y)) <= (FLT_COMPAR_TOL_FACTOR * FLT_EPSILON))
#define FLT_EQUAL(_x, _y) (fabs((_x) - (_y)) <= (FLT_COMPAR_TOL_FACTOR * FLT_EPSILON))
...
...
src/util/src/tcompare.c
浏览文件 @
e87118e5
...
@@ -327,10 +327,10 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c
...
@@ -327,10 +327,10 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c
int32_t
compareStrPatternComp
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
compareStrPatternComp
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
SPatternCompareInfo
pInfo
=
{
'%'
,
'_'
};
SPatternCompareInfo
pInfo
=
{
'%'
,
'_'
};
char
pattern
[
128
]
=
{
0
};
assert
(
varDataLen
(
pRight
)
<=
TSDB_MAX_FIELD_LEN
);
char
*
pattern
=
calloc
(
varDataLen
(
pRight
)
+
1
,
sizeof
(
char
));
memcpy
(
pattern
,
varDataVal
(
pRight
),
varDataLen
(
pRight
));
memcpy
(
pattern
,
varDataVal
(
pRight
),
varDataLen
(
pRight
));
assert
(
varDataLen
(
pRight
)
<
128
);
size_t
sz
=
varDataLen
(
pLeft
);
size_t
sz
=
varDataLen
(
pLeft
);
char
*
buf
=
malloc
(
sz
+
1
);
char
*
buf
=
malloc
(
sz
+
1
);
...
@@ -339,6 +339,7 @@ int32_t compareStrPatternComp(const void* pLeft, const void* pRight) {
...
@@ -339,6 +339,7 @@ int32_t compareStrPatternComp(const void* pLeft, const void* pRight) {
int32_t
ret
=
patternMatch
(
pattern
,
buf
,
sz
,
&
pInfo
);
int32_t
ret
=
patternMatch
(
pattern
,
buf
,
sz
,
&
pInfo
);
free
(
buf
);
free
(
buf
);
free
(
pattern
);
return
(
ret
==
TSDB_PATTERN_MATCH
)
?
0
:
1
;
return
(
ret
==
TSDB_PATTERN_MATCH
)
?
0
:
1
;
}
}
...
@@ -356,13 +357,14 @@ int32_t compareFindItemInSet(const void *pLeft, const void* pRight) {
...
@@ -356,13 +357,14 @@ int32_t compareFindItemInSet(const void *pLeft, const void* pRight) {
int32_t
compareWStrPatternComp
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
compareWStrPatternComp
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
SPatternCompareInfo
pInfo
=
{
'%'
,
'_'
};
SPatternCompareInfo
pInfo
=
{
'%'
,
'_'
};
wchar_t
pattern
[
128
]
=
{
0
}
;
assert
(
varDataLen
(
pRight
)
<=
TSDB_MAX_FIELD_LEN
*
TSDB_NCHAR_SIZE
)
;
assert
(
TSDB_PATTERN_STRING_MAX_LEN
<
128
);
wchar_t
*
pattern
=
calloc
(
varDataLen
(
pRight
)
+
1
,
sizeof
(
wchar_t
)
);
memcpy
(
pattern
,
varDataVal
(
pRight
),
varDataLen
(
pRight
));
memcpy
(
pattern
,
varDataVal
(
pRight
),
varDataLen
(
pRight
));
assert
(
varDataLen
(
pRight
)
<
128
);
assert
(
varDataLen
(
pRight
)
<
128
);
int32_t
ret
=
WCSPatternMatch
(
pattern
,
varDataVal
(
pLeft
),
varDataLen
(
pLeft
)
/
TSDB_NCHAR_SIZE
,
&
pInfo
);
int32_t
ret
=
WCSPatternMatch
(
pattern
,
varDataVal
(
pLeft
),
varDataLen
(
pLeft
)
/
TSDB_NCHAR_SIZE
,
&
pInfo
);
free
(
pattern
);
return
(
ret
==
TSDB_PATTERN_MATCH
)
?
0
:
1
;
return
(
ret
==
TSDB_PATTERN_MATCH
)
?
0
:
1
;
}
}
...
...
tests/perftest-scripts/perftest-query.sh
浏览文件 @
e87118e5
...
@@ -101,7 +101,14 @@ function runQueryPerfTest {
...
@@ -101,7 +101,14 @@ function runQueryPerfTest {
python3 insert/insertFromCSVPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 insert/insertFromCSVPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
|
tee
-a
$PERFORMANCE_TEST_REPORT
echo
"=========== taosdemo performance: 4 int columns, 10000 tables, 100000 recoreds per table ==========="
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
|
tee
-a
$PERFORMANCE_TEST_REPORT
echo
"=========== taosdemo performance: 400 int columns, 400 double columns, 200 binary(128) columns, 10000 tables, 1000 recoreds per table ==========="
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
-i
400
-D
400
-B
200
-t
10000
-r
100 |
tee
-a
$PERFORMANCE_TEST_REPORT
echo
"=========== taosdemo performance: 1900 int columns, 1900 double columns, 200 binary(128) columns, 10000 tables, 1000 recoreds per table ==========="
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
-i
1900
-D
1900
-B
200
-t
10000
-r
100 |
tee
-a
$PERFORMANCE_TEST_REPORT
}
}
...
...
tests/pytest/fulltest.sh
浏览文件 @
e87118e5
...
@@ -381,8 +381,9 @@ python3 ./test.py -f query/querySession.py
...
@@ -381,8 +381,9 @@ python3 ./test.py -f query/querySession.py
python3 test.py
-f
alter/alter_create_exception.py
python3 test.py
-f
alter/alter_create_exception.py
python3 ./test.py
-f
insert/flushwhiledrop.py
python3 ./test.py
-f
insert/flushwhiledrop.py
python3 ./test.py
-f
insert/schemalessInsert.py
python3 ./test.py
-f
insert/schemalessInsert.py
python3 ./test.py
-f
alter/alterColMultiTimes.py
python3 ./test.py
-f
alter/alterColMultiTimes.py
python3 ./test.py
-f
query/queryTbnameUpperLower.py
python3 ./test.py
-f
query/queryWildcardLength.py
python3 ./test.py
-f
query/queryTbnameUpperLower.py
#======================p4-end===============
#======================p4-end===============
...
...
tests/pytest/functions/showOfflineThresholdIs864000.py
浏览文件 @
e87118e5
...
@@ -25,7 +25,7 @@ class TDTestCase:
...
@@ -25,7 +25,7 @@ class TDTestCase:
def
run
(
self
):
def
run
(
self
):
tdSql
.
query
(
"show variables"
)
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
5
3
,
1
,
864000
)
tdSql
.
checkData
(
5
4
,
1
,
864000
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/pytest/query/queryError.py
浏览文件 @
e87118e5
...
@@ -65,6 +65,10 @@ class TDTestCase:
...
@@ -65,6 +65,10 @@ class TDTestCase:
# TD-2208
# TD-2208
tdSql
.
error
(
"select diff(tagtype),top(tagtype,1) from dev_001"
)
tdSql
.
error
(
"select diff(tagtype),top(tagtype,1) from dev_001"
)
# TD-6006
tdSql
.
error
(
"select * from dev_001 where 'name' is not null"
)
tdSql
.
error
(
"select * from dev_001 where
\"
name
\"
= 'first'"
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/query/queryWildcardLength.py
0 → 100644
浏览文件 @
e87118e5
###################################################################
# 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 -*-
from
copy
import
deepcopy
import
string
import
random
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
cleanTb
(
self
):
query_sql
=
"show stables"
res_row_list
=
tdSql
.
query
(
query_sql
,
True
)
stb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
for
stb
in
stb_list
:
tdSql
.
execute
(
f
'drop table if exists
{
stb
}
'
)
query_sql
=
"show tables"
res_row_list
=
tdSql
.
query
(
query_sql
,
True
)
tb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
for
tb
in
tb_list
:
tdSql
.
execute
(
f
'drop table if exists
{
tb
}
'
)
def
getLongWildcardStr
(
self
,
len
=
None
):
"""
generate long wildcard str
"""
maxWildCardsLength
=
int
(
tdSql
.
getVariable
(
'maxWildCardsLength'
)[
0
])
if
len
:
chars
=
''
.
join
(
random
.
choice
(
string
.
ascii_letters
.
lower
())
for
i
in
range
(
len
))
else
:
chars
=
''
.
join
(
random
.
choice
(
string
.
ascii_letters
.
lower
())
for
i
in
range
(
maxWildCardsLength
+
1
))
return
chars
def
genTableName
(
self
):
'''
generate table name
hp_name--->'%str'
lp_name--->'str%'
ul_name--->'st_r'
'''
table_name
=
self
.
getLongWildcardStr
()
table_name_list
=
list
(
table_name
)
table_name_list
.
pop
(
-
1
)
if
len
(
table_name_list
)
>
1
:
lp_name
=
deepcopy
(
table_name_list
)
lp_name
[
-
1
]
=
'%'
lp_name
=
''
.
join
(
lp_name
)
ul_name
=
list
(
lp_name
)
ul_name
[
int
(
len
(
ul_name
)
/
2
)]
=
'_'
ul_name
=
''
.
join
(
ul_name
)
table_name_list
=
list
(
table_name
)
hp_name
=
deepcopy
(
table_name_list
)
hp_name
.
pop
(
1
)
hp_name
[
0
]
=
'%'
hp_name
=
''
.
join
(
hp_name
)
else
:
hp_name
=
'%'
lp_name
=
'%'
ul_name
=
'_'
return
table_name
,
hp_name
,
lp_name
,
ul_name
def
checkRegularTableWildcardLength
(
self
):
'''
check regular table wildcard length with % and _
'''
self
.
cleanTb
()
table_name
,
hp_name
,
lp_name
,
ul_name
=
self
.
genTableName
()
tdSql
.
execute
(
f
"CREATE TABLE
{
table_name
}
(ts timestamp, a1 int)"
)
sql_list
=
[
f
'show tables like "
{
hp_name
}
"'
,
f
'show tables like "
{
lp_name
}
"'
,
f
'show tables like "
{
ul_name
}
"'
]
for
sql
in
sql_list
:
tdSql
.
query
(
sql
)
if
len
(
table_name
)
>=
1
:
tdSql
.
checkRows
(
1
)
else
:
tdSql
.
error
(
sql
)
exceed_sql_list
=
[
f
'show tables like "%
{
hp_name
}
"'
,
f
'show tables like "
{
lp_name
}
%"'
,
f
'show tables like "
{
ul_name
}
%"'
]
for
sql
in
exceed_sql_list
:
tdSql
.
error
(
sql
)
def
checkSuperTableWildcardLength
(
self
):
'''
check super table wildcard length with % and _
'''
self
.
cleanTb
()
table_name
,
hp_name
,
lp_name
,
ul_name
=
self
.
genTableName
()
tdSql
.
execute
(
f
"CREATE TABLE
{
table_name
}
(ts timestamp, c1 int) tags (t1 int)"
)
sql_list
=
[
f
'show stables like "
{
hp_name
}
"'
,
f
'show stables like "
{
lp_name
}
"'
,
f
'show stables like "
{
ul_name
}
"'
]
for
sql
in
sql_list
:
tdSql
.
query
(
sql
)
if
len
(
table_name
)
>=
1
:
tdSql
.
checkRows
(
1
)
else
:
tdSql
.
error
(
sql
)
exceed_sql_list
=
[
f
'show stables like "%
{
hp_name
}
"'
,
f
'show stables like "
{
lp_name
}
%"'
,
f
'show stables like "
{
ul_name
}
%"'
]
for
sql
in
exceed_sql_list
:
tdSql
.
error
(
sql
)
def
checkRegularWildcardSelectLength
(
self
):
'''
check regular table wildcard select length with % and _
'''
self
.
cleanTb
()
table_name
,
hp_name
,
lp_name
,
ul_name
=
self
.
genTableName
()
tdSql
.
execute
(
f
"CREATE TABLE
{
table_name
}
(ts timestamp, bi1 binary(200), nc1 nchar(200))"
)
tdSql
.
execute
(
f
'insert into
{
table_name
}
values (now, "
{
table_name
}
", "
{
table_name
}
")'
)
sql_list
=
[
f
'select * from
{
table_name
}
where bi1 like "
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
lp_name
}
"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
ul_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
lp_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
ul_name
}
"'
]
for
sql
in
sql_list
:
tdSql
.
query
(
sql
)
if
len
(
table_name
)
>=
1
:
tdSql
.
checkRows
(
1
)
else
:
tdSql
.
error
(
sql
)
exceed_sql_list
=
[
f
'select * from
{
table_name
}
where bi1 like "%
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
lp_name
}
%"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
ul_name
}
%"'
,
f
'select * from
{
table_name
}
where nc1 like "%
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
lp_name
}
%"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
ul_name
}
%"'
]
for
sql
in
exceed_sql_list
:
tdSql
.
error
(
sql
)
def
checkStbWildcardSelectLength
(
self
):
'''
check stb wildcard select length with % and _
'''
self
.
cleanTb
()
table_name
,
hp_name
,
lp_name
,
ul_name
=
self
.
genTableName
()
tdSql
.
execute
(
f
'CREATE TABLE
{
table_name
}
(ts timestamp, bi1 binary(200), nc1 nchar(200)) tags (si1 binary(200), sc1 nchar(200))'
)
tdSql
.
execute
(
f
'create table
{
table_name
}
_sub1 using
{
table_name
}
tags ("
{
table_name
}
", "
{
table_name
}
")'
)
tdSql
.
execute
(
f
'insert into
{
table_name
}
_sub1 values (now, "
{
table_name
}
", "
{
table_name
}
");'
)
sql_list
=
[
f
'select * from
{
table_name
}
where bi1 like "
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
lp_name
}
"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
ul_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
lp_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
ul_name
}
"'
,
f
'select * from
{
table_name
}
where si1 like "
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where si1 like "
{
lp_name
}
"'
,
f
'select * from
{
table_name
}
where si1 like "
{
ul_name
}
"'
,
f
'select * from
{
table_name
}
where sc1 like "
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where sc1 like "
{
lp_name
}
"'
,
f
'select * from
{
table_name
}
where sc1 like "
{
ul_name
}
"'
]
for
sql
in
sql_list
:
tdSql
.
query
(
sql
)
if
len
(
table_name
)
>=
1
:
tdSql
.
checkRows
(
1
)
else
:
tdSql
.
error
(
sql
)
exceed_sql_list
=
[
f
'select * from
{
table_name
}
where bi1 like "%
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
lp_name
}
%"'
,
f
'select * from
{
table_name
}
where bi1 like "
{
ul_name
}
%"'
,
f
'select * from
{
table_name
}
where nc1 like "%
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
lp_name
}
%"'
,
f
'select * from
{
table_name
}
where nc1 like "
{
ul_name
}
%"'
,
f
'select * from
{
table_name
}
where si1 like "%
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where si1 like "
{
lp_name
}
%"'
,
f
'select * from
{
table_name
}
where si1 like "
{
ul_name
}
%"'
,
f
'select * from
{
table_name
}
where sc1 like "%
{
hp_name
}
"'
,
f
'select * from
{
table_name
}
where sc1 like "
{
lp_name
}
%"'
,
f
'select * from
{
table_name
}
where sc1 like "
{
ul_name
}
%"'
]
for
sql
in
exceed_sql_list
:
tdSql
.
error
(
sql
)
def
run
(
self
):
tdSql
.
prepare
()
self
.
checkRegularTableWildcardLength
()
self
.
checkSuperTableWildcardLength
()
self
.
checkRegularWildcardSelectLength
()
self
.
checkStbWildcardSelectLength
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
浏览文件 @
e87118e5
...
@@ -36,7 +36,7 @@ class TDTestCase:
...
@@ -36,7 +36,7 @@ class TDTestCase:
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
break
return
buildPath
return
buildPath
...
@@ -46,14 +46,15 @@ class TDTestCase:
...
@@ -46,14 +46,15 @@ class TDTestCase:
tdLog
.
exit
(
"taosd not found!"
)
tdLog
.
exit
(
"taosd not found!"
)
else
:
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# insert data from a special timestamp
# insert data from a special timestamp
# check stable stb0
# check stable stb0
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabase.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabase.json -y "
%
binPath
)
tdSql
.
execute
(
"use nsdb"
)
tdSql
.
execute
(
"use nsdb"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
@@ -64,9 +65,9 @@ class TDTestCase:
...
@@ -64,9 +65,9 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select last(ts) from stb0"
)
tdSql
.
query
(
"select last(ts) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
# check stable stb1 which is insert with disord
# check stable stb1 which is insert with disord
...
@@ -78,16 +79,18 @@ class TDTestCase:
...
@@ -78,16 +79,18 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
# check c8 is an nano timestamp
# check c8 is an nano timestamp
tdSql
.
query
(
"describe stb1"
)
tdSql
.
query
(
"describe stb1"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
# check insert timestamp_step is nano_second
# check insert timestamp_step is nano_second
tdSql
.
query
(
"select last(ts) from stb1"
)
tdSql
.
query
(
"select last(ts) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
# insert data from now time
# insert data from now time
# check stable stb0
# check stable stb0
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabaseNow.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabaseNow.json -y "
%
binPath
)
tdSql
.
execute
(
"use nsdb2"
)
tdSql
.
execute
(
"use nsdb2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
@@ -99,11 +102,14 @@ class TDTestCase:
...
@@ -99,11 +102,14 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
# check c8 is an nano timestamp
# check c8 is an nano timestamp
tdSql
.
query
(
"describe stb0"
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
# insert by csv files and timetamp is long int , strings in ts and
# cols
# insert by csv files and timetamp is long int , strings in ts and cols
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabasecsv.json -y "
%
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabasecsv.json -y "
%
binPath
)
binPath
)
tdSql
.
execute
(
"use nsdbcsv"
)
tdSql
.
execute
(
"use nsdbcsv"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
@@ -111,29 +117,37 @@ class TDTestCase:
...
@@ -111,29 +117,37 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
3
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
3
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select count(*) from stb0 where ts >
\"
2021-07-01 00:00:00.490000000
\"
"
)
tdSql
.
query
(
"select count(*) from stb0 where ts >
\"
2021-07-01 00:00:00.490000000
\"
"
)
tdSql
.
checkData
(
0
,
0
,
5000
)
tdSql
.
checkData
(
0
,
0
,
5000
)
tdSql
.
query
(
"select count(*) from stb0 where ts < 1626918583000000000"
)
tdSql
.
query
(
"select count(*) from stb0 where ts < 1626918583000000000"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNano*.py.sql"
)
# taosdemo test insert with command and parameter , detals show taosdemo --help
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"%staosdemo -u root -P taosdata -p 6030 -a 1 -m pre -n 10 -T 20 -t 60 -o res.txt -y "
%
binPath
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNano*.py.sql"
)
# taosdemo test insert with command and parameter , detals show
# taosdemo --help
os
.
system
(
"%staosdemo -u root -ptaosdata -P 6030 -a 1 -m pre -n 10 -T 20 -t 60 -o res.txt -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from test.meters"
)
tdSql
.
query
(
"select count(*) from test.meters"
)
tdSql
.
checkData
(
0
,
0
,
600
)
tdSql
.
checkData
(
0
,
0
,
600
)
# check taosdemo -s
# check taosdemo -s
sqls_ls
=
[
'drop database if exists nsdbsql;'
,
'create database nsdbsql precision "ns" keep 3600 days 6 update 1;'
,
sqls_ls
=
[
'use nsdbsql;'
,
'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);'
,
'drop database if exists nsdbsql;'
,
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);'
,
'create database nsdbsql precision "ns" keep 3600 days 6 update 1;'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);'
,
'use nsdbsql;'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 85, 32, 0.76);'
]
'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);'
,
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 85, 32, 0.76);'
]
with
open
(
"./taosdemoTestNanoCreateDB.sql"
,
mode
=
"a"
)
as
sql_files
:
with
open
(
"./taosdemoTestNanoCreateDB.sql"
,
mode
=
"a"
)
as
sql_files
:
for
sql
in
sqls_ls
:
for
sql
in
sqls_ls
:
sql_files
.
write
(
sql
+
"
\n
"
)
sql_files
.
write
(
sql
+
"
\n
"
)
sql_files
.
close
()
sql_files
.
close
()
sleep
(
10
)
sleep
(
10
)
...
@@ -141,11 +155,10 @@ class TDTestCase:
...
@@ -141,11 +155,10 @@ class TDTestCase:
os
.
system
(
"%staosdemo -s taosdemoTestNanoCreateDB.sql -y "
%
binPath
)
os
.
system
(
"%staosdemo -s taosdemoTestNanoCreateDB.sql -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from nsdbsql.meters"
)
tdSql
.
query
(
"select count(*) from nsdbsql.meters"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
checkData
(
0
,
0
,
2
)
os
.
system
(
"rm -rf ./res.txt"
)
os
.
system
(
"rm -rf ./res.txt"
)
os
.
system
(
"rm -rf ./*.py.sql"
)
os
.
system
(
"rm -rf ./*.py.sql"
)
os
.
system
(
"rm -rf ./taosdemoTestNanoCreateDB.sql"
)
os
.
system
(
"rm -rf ./taosdemoTestNanoCreateDB.sql"
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
浏览文件 @
e87118e5
...
@@ -120,7 +120,7 @@ class TDTestCase:
...
@@ -120,7 +120,7 @@ class TDTestCase:
os
.
system
(
"rm -rf tools/taosdemoAllTest/taosdemoTestSupportNano*.py.sql"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/taosdemoTestSupportNano*.py.sql"
)
# taosdemo test insert with command and parameter , detals show taosdemo --help
# taosdemo test insert with command and parameter , detals show taosdemo --help
os
.
system
(
"%staosdemo -u root -
P taosdata -p
6030 -a 1 -m pre -n 10 -T 20 -t 60 -o res.txt -y "
%
binPath
)
os
.
system
(
"%staosdemo -u root -
ptaosdata -P
6030 -a 1 -m pre -n 10 -T 20 -t 60 -o res.txt -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from test.meters"
)
tdSql
.
query
(
"select count(*) from test.meters"
)
tdSql
.
checkData
(
0
,
0
,
600
)
tdSql
.
checkData
(
0
,
0
,
600
)
# check taosdemo -s
# check taosdemo -s
...
...
tests/pytest/tools/taosdemoPerformance.py
浏览文件 @
e87118e5
...
@@ -63,7 +63,7 @@ class taosdemoPerformace:
...
@@ -63,7 +63,7 @@ class taosdemoPerformace:
"batch_create_tbl_num"
:
10
,
"batch_create_tbl_num"
:
10
,
"insert_mode"
:
"taosc"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
self
.
numOfRows
,
"insert_rows"
:
self
.
numOfRows
,
"interlace_rows"
:
10
0
,
"interlace_rows"
:
0
,
"max_sql_len"
:
1024000
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"disorder_range"
:
1000
,
...
@@ -172,7 +172,6 @@ class taosdemoPerformace:
...
@@ -172,7 +172,6 @@ class taosdemoPerformace:
cursor
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
.
execute
(
"use %s"
%
self
.
dbName
)
cursor
.
execute
(
"use %s"
%
self
.
dbName
)
cursor
.
execute
(
"create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float, branch binary(50), type binary(20), numoftables int, numofrows int, numofint int, numofdouble int, numofbinary int)"
)
cursor
.
execute
(
"create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float, branch binary(50), type binary(20), numoftables int, numofrows int, numofint int, numofdouble int, numofbinary int)"
)
print
(
"==================== taosdemo performance ===================="
)
print
(
"create tables time: %f"
%
float
(
self
.
createTableTime
))
print
(
"create tables time: %f"
%
float
(
self
.
createTableTime
))
print
(
"insert records time: %f"
%
float
(
self
.
insertRecordsTime
))
print
(
"insert records time: %f"
%
float
(
self
.
insertRecordsTime
))
print
(
"records per second: %f"
%
float
(
self
.
recordsPerSecond
))
print
(
"records per second: %f"
%
float
(
self
.
recordsPerSecond
))
...
...
tests/pytest/tools/taosdemoTestInterlace.py
浏览文件 @
e87118e5
...
@@ -49,7 +49,7 @@ class TDTestCase:
...
@@ -49,7 +49,7 @@ class TDTestCase:
else
:
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
taosdemoCmd
=
"%staosdemo -f tools/insert-interlace.json -
pp
2>&1 | grep sleep | wc -l"
%
binPath
taosdemoCmd
=
"%staosdemo -f tools/insert-interlace.json -
PP
2>&1 | grep sleep | wc -l"
%
binPath
sleepTimes
=
subprocess
.
check_output
(
sleepTimes
=
subprocess
.
check_output
(
taosdemoCmd
,
shell
=
True
).
decode
(
"utf-8"
)
taosdemoCmd
,
shell
=
True
).
decode
(
"utf-8"
)
print
(
"sleep times: %d"
%
int
(
sleepTimes
))
print
(
"sleep times: %d"
%
int
(
sleepTimes
))
...
...
tests/pytest/util/sql.py
浏览文件 @
e87118e5
...
@@ -81,6 +81,22 @@ class TDSql:
...
@@ -81,6 +81,22 @@ class TDSql:
return
self
.
queryResult
return
self
.
queryResult
return
self
.
queryRows
return
self
.
queryRows
def
getVariable
(
self
,
search_attr
):
'''
get variable of search_attr access "show variables"
'''
try
:
sql
=
'show variables'
param_list
=
self
.
query
(
sql
,
row_tag
=
True
)
for
param
in
param_list
:
if
param
[
0
]
==
search_attr
:
return
param
[
1
],
param_list
except
Exception
as
e
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
args
=
(
caller
.
filename
,
caller
.
lineno
,
sql
,
repr
(
e
))
tdLog
.
notice
(
"%s(%d) failed: sql:%s, %s"
%
args
)
raise
Exception
(
repr
(
e
))
def
getColNameList
(
self
,
sql
,
col_tag
=
None
):
def
getColNameList
(
self
,
sql
,
col_tag
=
None
):
self
.
sql
=
sql
self
.
sql
=
sql
try
:
try
:
...
...
tests/script/general/parser/interp.sim
浏览文件 @
e87118e5
...
@@ -68,4 +68,19 @@ print ================== server restart completed
...
@@ -68,4 +68,19 @@ print ================== server restart completed
run general/parser/interp_test.sim
run general/parser/interp_test.sim
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
print ================= TD-5931
sql create stable st5931(ts timestamp, f int) tags(t int)
sql create table ct5931 using st5931 tags(1)
sql create table nt5931(ts timestamp, f int)
sql select interp(*) from nt5931 where ts=now
sql select interp(*) from st5931 where ts=now
sql select interp(*) from ct5931 where ts=now
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录