Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
68c8b30e
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看板
提交
68c8b30e
编写于
8月 13, 2021
作者:
sangshuduo
浏览文件
操作
浏览文件
下载
差异文件
merge with master.
上级
a2668155
356018a9
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
158 addition
and
79 deletion
+158
-79
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+75
-42
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/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+12
-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/taosdemoTestInterlace.py
tests/pytest/tools/taosdemoTestInterlace.py
+1
-1
tests/script/general/parser/interp.sim
tests/script/general/parser/interp.sim
+16
-1
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
68c8b30e
...
...
@@ -77,7 +77,7 @@ extern char configDir[];
#define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS)
#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_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
...
...
@@ -216,7 +216,7 @@ typedef struct SArguments_S {
uint16_t
port
;
uint16_t
iface
;
char
*
user
;
char
*
password
;
char
password
[
MAX_PASSWORD_SIZE
]
;
char
*
database
;
int
replica
;
char
*
tb_prefix
;
...
...
@@ -713,24 +713,24 @@ static void printHelp() {
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-u"
,
indent
,
"The TDengine user name to use when connecting to the server. Default is 'root'."
);
#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'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
"Configuration directory. Default is '/etc/power/'."
);
#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'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
"Configuration directory. Default is '/etc/tq/'."
);
#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'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-c"
,
indent
,
"Configuration directory. Default is '/etc/taos/'."
);
#endif
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-h"
,
indent
,
"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."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-I"
,
indent
,
#if STMT_IFACE_ENABLED == 1
...
...
@@ -830,11 +830,11 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
}
arguments
->
host
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-
p
"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-
P
"
)
==
0
)
{
if
((
argc
==
i
+
1
)
||
(
!
isStringNumber
(
argv
[
i
+
1
])))
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-
p
need a number following!
\n
"
);
errorPrint
(
"%s"
,
"
\n\t
-
P
need a number following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
arguments
->
port
=
atoi
(
argv
[
++
i
]);
...
...
@@ -864,13 +864,13 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
}
arguments
->
user
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-P"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-P need a valid string following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
else
if
(
strncmp
(
argv
[
i
],
"-p"
,
2
)
==
0
)
{
if
(
strlen
(
argv
[
i
])
==
2
)
{
printf
(
"Enter password:"
);
scanf
(
"%s"
,
arguments
->
password
);
}
else
{
tstrncpy
(
arguments
->
password
,
(
char
*
)(
argv
[
i
]
+
2
),
MAX_PASSWORD_SIZE
);
}
arguments
->
password
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-o"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
...
...
@@ -1069,7 +1069,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments
->
debug_print
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-gg"
)
==
0
)
{
arguments
->
verbose_print
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-
pp
"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-
PP
"
)
==
0
)
{
arguments
->
performance_print
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-O"
)
==
0
)
{
if
((
argc
==
i
+
1
)
||
...
...
@@ -2322,15 +2322,15 @@ static void printfDbInfoForQueryToFile(
}
static
void
printfQuerySystemInfo
(
TAOS
*
taos
)
{
char
filename
[
BUFFER_SIZE
+
1
]
=
{
0
};
char
buffer
[
BUFFER_SIZE
+
1
]
=
{
0
};
char
filename
[
MAX_FILE_NAME_LEN
]
=
{
0
};
char
buffer
[
1024
]
=
{
0
};
TAOS_RES
*
res
;
time_t
t
;
struct
tm
*
lt
;
time
(
&
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_sec
);
...
...
@@ -2362,12 +2362,12 @@ static void printfQuerySystemInfo(TAOS * taos) {
printfDbInfoForQueryToFile
(
filename
,
dbInfos
[
i
],
i
);
// 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
);
xDumpResultToFile
(
filename
,
res
);
// 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
);
xDumpResultToFile
(
filename
,
res
);
free
(
dbInfos
[
i
]);
...
...
@@ -2716,7 +2716,7 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
char
*
dbName
,
char
*
sTblName
,
char
**
childTblNameOfSuperTbl
,
int64_t
*
childTblCountOfSuperTbl
,
int64_t
limit
,
uint64_t
offset
)
{
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
command
[
1024
]
=
"
\0
"
;
char
limitBuf
[
100
]
=
"
\0
"
;
TAOS_RES
*
res
;
...
...
@@ -2730,7 +2730,7 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
}
//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
);
res
=
taos_query
(
taos
,
command
);
...
...
@@ -2808,13 +2808,13 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName,
static
int
getSuperTableFromServer
(
TAOS
*
taos
,
char
*
dbName
,
SSuperTable
*
superTbls
)
{
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
command
[
1024
]
=
"
\0
"
;
TAOS_RES
*
res
;
TAOS_ROW
row
=
NULL
;
int
count
=
0
;
//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
);
int32_t
code
=
taos_errno
(
res
);
if
(
code
!=
0
)
{
...
...
@@ -2894,7 +2894,8 @@ static int createSuperTable(
TAOS
*
taos
,
char
*
dbName
,
SSuperTable
*
superTbl
)
{
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
*
command
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
command
);
char
cols
[
COL_BUFFER_LEN
]
=
"
\0
"
;
int
colIndex
;
...
...
@@ -2905,6 +2906,7 @@ static int createSuperTable(
if
(
superTbl
->
columnCount
==
0
)
{
errorPrint
(
"%s() LN%d, super table column count is %d
\n
"
,
__func__
,
__LINE__
,
superTbl
->
columnCount
);
free
(
command
);
return
-
1
;
}
...
...
@@ -2965,6 +2967,7 @@ static int createSuperTable(
lenOfOneRow
+=
TIMESTAMP_BUFF_LEN
;
}
else
{
taos_close
(
taos
);
free
(
command
);
errorPrint
(
"%s() LN%d, config error data type : %s
\n
"
,
__func__
,
__LINE__
,
dataType
);
exit
(
EXIT_FAILURE
);
...
...
@@ -2977,6 +2980,7 @@ static int createSuperTable(
superTbl
->
colsOfCreateChildTable
=
(
char
*
)
calloc
(
len
+
20
,
1
);
if
(
NULL
==
superTbl
->
colsOfCreateChildTable
)
{
taos_close
(
taos
);
free
(
command
);
errorPrint
(
"%s() LN%d, Failed when calloc, size:%d"
,
__func__
,
__LINE__
,
len
+
1
);
exit
(
EXIT_FAILURE
);
...
...
@@ -2989,6 +2993,7 @@ static int createSuperTable(
if
(
superTbl
->
tagCount
==
0
)
{
errorPrint
(
"%s() LN%d, super table tag count is %d
\n
"
,
__func__
,
__LINE__
,
superTbl
->
tagCount
);
free
(
command
);
return
-
1
;
}
...
...
@@ -3052,6 +3057,7 @@ static int createSuperTable(
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
DOUBLE_BUFF_LEN
;
}
else
{
taos_close
(
taos
);
free
(
command
);
errorPrint
(
"%s() LN%d, config error tag type : %s
\n
"
,
__func__
,
__LINE__
,
dataType
);
exit
(
EXIT_FAILURE
);
...
...
@@ -3069,13 +3075,16 @@ static int createSuperTable(
if
(
0
!=
queryDbExec
(
taos
,
command
,
NO_INSERT_TYPE
,
false
))
{
errorPrint
(
"create supertable %s failed!
\n\n
"
,
superTbl
->
sTblName
);
free
(
command
);
return
-
1
;
}
debugPrint
(
"create supertable %s success!
\n\n
"
,
superTbl
->
sTblName
);
free
(
command
);
return
0
;
}
static
int
createDatabasesAndStables
(
)
{
int
createDatabasesAndStables
(
char
*
command
)
{
TAOS
*
taos
=
NULL
;
int
ret
=
0
;
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
NULL
,
g_Dbs
.
port
);
...
...
@@ -3083,7 +3092,6 @@ static int createDatabasesAndStables() {
errorPrint
(
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
return
-
1
;
}
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
if
(
g_Dbs
.
db
[
i
].
drop
)
{
...
...
@@ -7767,12 +7775,15 @@ static void *readTable(void *sarg) {
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
setThreadName
(
"readTable"
);
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
*
command
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
command
);
uint64_t
sTime
=
pThreadInfo
->
start_time
;
char
*
tb_prefix
=
pThreadInfo
->
tb_prefix
;
FILE
*
fp
=
fopen
(
pThreadInfo
->
filePath
,
"a"
);
if
(
NULL
==
fp
)
{
errorPrint
(
"fopen %s fail, reason:%s.
\n
"
,
pThreadInfo
->
filePath
,
strerror
(
errno
));
free
(
command
);
return
NULL
;
}
...
...
@@ -7811,6 +7822,7 @@ static void *readTable(void *sarg) {
taos_free_result
(
pSql
);
taos_close
(
taos
);
fclose
(
fp
);
free
(
command
);
return
NULL
;
}
...
...
@@ -7831,6 +7843,7 @@ static void *readTable(void *sarg) {
}
fprintf
(
fp
,
"
\n
"
);
fclose
(
fp
);
free
(
command
);
#endif
return
NULL
;
}
...
...
@@ -7840,10 +7853,13 @@ static void *readMetric(void *sarg) {
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
TAOS
*
taos
=
pThreadInfo
->
taos
;
setThreadName
(
"readMetric"
);
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
*
command
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
command
);
FILE
*
fp
=
fopen
(
pThreadInfo
->
filePath
,
"a"
);
if
(
NULL
==
fp
)
{
printf
(
"fopen %s fail, reason:%s.
\n
"
,
pThreadInfo
->
filePath
,
strerror
(
errno
));
free
(
command
);
return
NULL
;
}
...
...
@@ -7888,6 +7904,7 @@ static void *readMetric(void *sarg) {
taos_free_result
(
pSql
);
taos_close
(
taos
);
fclose
(
fp
);
free
(
command
);
return
NULL
;
}
int
count
=
0
;
...
...
@@ -7905,6 +7922,7 @@ static void *readMetric(void *sarg) {
fprintf
(
fp
,
"
\n
"
);
}
fclose
(
fp
);
free
(
command
);
#endif
return
NULL
;
}
...
...
@@ -7941,11 +7959,16 @@ static int insertTestProcess() {
init_rand_data
();
// create database and super tables
if
(
createDatabasesAndStables
()
!=
0
)
{
char
*
cmdBuffer
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
cmdBuffer
);
if
(
createDatabasesAndStables
(
cmdBuffer
)
!=
0
)
{
if
(
g_fpOfInsertResult
)
fclose
(
g_fpOfInsertResult
);
free
(
cmdBuffer
);
return
-
1
;
}
free
(
cmdBuffer
);
// pretreatement
if
(
prepareSampleData
()
!=
0
)
{
...
...
@@ -8114,7 +8137,9 @@ static void replaceChildTblName(char* inSql, char* outSql, int tblIndex) {
}
static
void
*
superTableQuery
(
void
*
sarg
)
{
char
sqlstr
[
BUFFER_SIZE
];
char
*
sqlstr
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
sqlstr
);
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
setThreadName
(
"superTableQuery"
);
...
...
@@ -8129,6 +8154,7 @@ static void *superTableQuery(void *sarg) {
if
(
taos
==
NULL
)
{
errorPrint
(
"[%d] Failed to connect to TDengine, reason:%s
\n
"
,
pThreadInfo
->
threadID
,
taos_errstr
(
NULL
));
free
(
sqlstr
);
return
NULL
;
}
else
{
pThreadInfo
->
taos
=
taos
;
...
...
@@ -8153,7 +8179,7 @@ static void *superTableQuery(void *sarg) {
st
=
taosGetTimestampMs
();
for
(
int
i
=
pThreadInfo
->
start_table_from
;
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
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
);
if
(
g_queryInfo
.
superQueryInfo
.
result
[
j
][
0
]
!=
'\0'
)
{
sprintf
(
pThreadInfo
->
filePath
,
"%s-%d"
,
...
...
@@ -8184,6 +8210,7 @@ static void *superTableQuery(void *sarg) {
(
double
)(
et
-
st
)
/
1000
.
0
);
}
free
(
sqlstr
);
return
NULL
;
}
...
...
@@ -8417,13 +8444,16 @@ static TAOS_SUB* subscribeImpl(
static
void
*
superSubscribe
(
void
*
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
};
uint64_t
tsubSeq
;
setThreadName
(
"superSub"
);
if
(
pThreadInfo
->
ntables
>
MAX_QUERY_SQL_COUNT
)
{
free
(
subSqlStr
);
errorPrint
(
"The table number(%"
PRId64
") of the thread is more than max query sql count: %d
\n
"
,
pThreadInfo
->
ntables
,
MAX_QUERY_SQL_COUNT
);
exit
(
EXIT_FAILURE
);
...
...
@@ -8438,6 +8468,7 @@ static void *superSubscribe(void *sarg) {
if
(
pThreadInfo
->
taos
==
NULL
)
{
errorPrint
(
"[%d] Failed to connect to TDengine, reason:%s
\n
"
,
pThreadInfo
->
threadID
,
taos_errstr
(
NULL
));
free
(
subSqlStr
);
return
NULL
;
}
}
...
...
@@ -8448,6 +8479,7 @@ static void *superSubscribe(void *sarg) {
taos_close
(
pThreadInfo
->
taos
);
errorPrint
(
"use database %s failed!
\n\n
"
,
g_queryInfo
.
dbName
);
free
(
subSqlStr
);
return
NULL
;
}
...
...
@@ -8462,25 +8494,26 @@ static void *superSubscribe(void *sarg) {
pThreadInfo
->
end_table_to
,
i
);
sprintf
(
topic
,
"taosdemo-subscribe-%"
PRIu64
"-%"
PRIu64
""
,
i
,
pThreadInfo
->
querySeq
);
memset
(
subSql
str
,
0
,
sizeof
(
subSqlstr
)
);
memset
(
subSql
Str
,
0
,
BUFFER_SIZE
);
replaceChildTblName
(
g_queryInfo
.
superQueryInfo
.
sql
[
pThreadInfo
->
querySeq
],
subSql
s
tr
,
i
);
subSql
S
tr
,
i
);
if
(
g_queryInfo
.
superQueryInfo
.
result
[
pThreadInfo
->
querySeq
][
0
]
!=
0
)
{
sprintf
(
pThreadInfo
->
filePath
,
"%s-%d"
,
g_queryInfo
.
superQueryInfo
.
result
[
pThreadInfo
->
querySeq
],
pThreadInfo
->
threadID
);
}
verbosePrint
(
"%s() LN%d, [%d] subSql
s
tr: %s
\n
"
,
__func__
,
__LINE__
,
pThreadInfo
->
threadID
,
subSql
s
tr
);
verbosePrint
(
"%s() LN%d, [%d] subSql
S
tr: %s
\n
"
,
__func__
,
__LINE__
,
pThreadInfo
->
threadID
,
subSql
S
tr
);
tsub
[
tsubSeq
]
=
subscribeImpl
(
STABLE_CLASS
,
pThreadInfo
,
subSql
s
tr
,
topic
,
pThreadInfo
,
subSql
S
tr
,
topic
,
g_queryInfo
.
superQueryInfo
.
subscribeRestart
,
g_queryInfo
.
superQueryInfo
.
subscribeInterval
);
if
(
NULL
==
tsub
[
tsubSeq
])
{
taos_close
(
pThreadInfo
->
taos
);
free
(
subSqlStr
);
return
NULL
;
}
}
...
...
@@ -8537,12 +8570,13 @@ static void *superSubscribe(void *sarg) {
consumed
[
tsubSeq
]
=
0
;
tsub
[
tsubSeq
]
=
subscribeImpl
(
STABLE_CLASS
,
pThreadInfo
,
subSql
s
tr
,
topic
,
pThreadInfo
,
subSql
S
tr
,
topic
,
g_queryInfo
.
superQueryInfo
.
subscribeRestart
,
g_queryInfo
.
superQueryInfo
.
subscribeInterval
);
if
(
NULL
==
tsub
[
tsubSeq
])
{
taos_close
(
pThreadInfo
->
taos
);
free
(
subSqlStr
);
return
NULL
;
}
}
...
...
@@ -8562,6 +8596,7 @@ static void *superSubscribe(void *sarg) {
}
taos_close
(
pThreadInfo
->
taos
);
free
(
subSqlStr
);
return
NULL
;
}
...
...
@@ -8864,9 +8899,7 @@ static void setParaFromArg() {
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
)
{
g_Dbs
.
port
=
g_args
.
port
;
...
...
src/query/src/qAggMain.c
浏览文件 @
68c8b30e
...
...
@@ -4062,12 +4062,15 @@ static void mergeTableBlockDist(SResultRowCellInfo* pResInfo, const STableBlockD
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
int32_t
numSteps
=
tsMaxRowsInFileBlock
/
TSDB_BLOCK_DIST_STEP_ROWS
;
pDist
->
dataBlockInfos
=
taosArrayInit
(
numSteps
,
sizeof
(
SFileBlockInfo
));
taosArraySetSize
(
pDist
->
dataBlockInfos
,
numSteps
);
int32_t
maxSteps
=
TSDB_MAX_MAX_ROW_FBLOCK
/
TSDB_BLOCK_DIST_STEP_ROWS
;
if
(
TSDB_MAX_MAX_ROW_FBLOCK
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
++
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
)
{
int32_t
srcNumBlocks
=
((
SFileBlockInfo
*
)
taosArrayGet
(
pSrc
->
dataBlockInfos
,
i
))
->
numBlocksOfStep
;
SFileBlockInfo
*
blockInfo
=
(
SFileBlockInfo
*
)
taosArrayGet
(
pDist
->
dataBlockInfos
,
i
);
...
...
src/query/src/qExecutor.c
浏览文件 @
68c8b30e
...
...
@@ -5024,6 +5024,9 @@ static SSDataBlock* doBlockInfoScan(void* param, bool* newgroup) {
tableBlockDist
.
numOfTables
=
(
int32_t
)
pOperator
->
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
;
int32_t
numRowSteps
=
tsMaxRowsInFileBlock
/
TSDB_BLOCK_DIST_STEP_ROWS
;
if
(
tsMaxRowsInFileBlock
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
++
numRowSteps
;
}
tableBlockDist
.
dataBlockInfos
=
taosArrayInit
(
numRowSteps
,
sizeof
(
SFileBlockInfo
));
taosArraySetSize
(
tableBlockDist
.
dataBlockInfos
,
numRowSteps
);
tableBlockDist
.
maxRows
=
INT_MIN
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
68c8b30e
...
...
@@ -691,6 +691,18 @@ static STableGroupInfo* trimTableGroup(STimeWindow* window, STableGroupInfo* pGr
TsdbQueryHandleT
tsdbQueryRowsInExternalWindow
(
STsdbRepo
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
SMemRef
*
pRef
)
{
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
);
pQueryHandle
->
loadExternalRow
=
true
;
pQueryHandle
->
currentLoadExternalRows
=
true
;
...
...
tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
浏览文件 @
68c8b30e
...
...
@@ -36,7 +36,7 @@ class TDTestCase:
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
...
...
@@ -46,14 +46,15 @@ class TDTestCase:
tdLog
.
exit
(
"taosd not found!"
)
else
:
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 data from a special timestamp
# 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
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
...
@@ -64,9 +65,9 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
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
...
...
@@ -78,16 +79,18 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
# check c8 is an nano timestamp
tdSql
.
query
(
"describe stb1"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
# check insert timestamp_step is nano_second
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
# 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
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
...
@@ -99,11 +102,14 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
# check c8 is an nano timestamp
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 "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabasecsv.json -y "
%
binPath
)
tdSql
.
execute
(
"use nsdbcsv"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
...
@@ -111,29 +117,37 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
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
.
query
(
"select count(*) from stb0 where ts < 1626918583000000000"
)
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
(
"%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 ./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
(
"%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
.
checkData
(
0
,
0
,
600
)
# check taosdemo -s
sqls_ls
=
[
'drop database if exists nsdbsql;'
,
'create database nsdbsql precision "ns" keep 3600 days 6 update 1;'
,
'use nsdbsql;'
,
'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);'
]
sqls_ls
=
[
'drop database if exists nsdbsql;'
,
'create database nsdbsql precision "ns" keep 3600 days 6 update 1;'
,
'use nsdbsql;'
,
'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
:
sql_files
.
write
(
sql
+
"
\n
"
)
sql_files
.
write
(
sql
+
"
\n
"
)
sql_files
.
close
()
sleep
(
10
)
...
...
@@ -141,11 +155,10 @@ class TDTestCase:
os
.
system
(
"%staosdemo -s taosdemoTestNanoCreateDB.sql -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from nsdbsql.meters"
)
tdSql
.
checkData
(
0
,
0
,
2
)
os
.
system
(
"rm -rf ./res.txt"
)
os
.
system
(
"rm -rf ./*.py.sql"
)
os
.
system
(
"rm -rf ./taosdemoTestNanoCreateDB.sql"
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
浏览文件 @
68c8b30e
...
...
@@ -120,7 +120,7 @@ class TDTestCase:
os
.
system
(
"rm -rf tools/taosdemoAllTest/taosdemoTestSupportNano*.py.sql"
)
# 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
.
checkData
(
0
,
0
,
600
)
# check taosdemo -s
...
...
tests/pytest/tools/taosdemoTestInterlace.py
浏览文件 @
68c8b30e
...
...
@@ -49,7 +49,7 @@ class TDTestCase:
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
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
(
taosdemoCmd
,
shell
=
True
).
decode
(
"utf-8"
)
print
(
"sleep times: %d"
%
int
(
sleepTimes
))
...
...
tests/script/general/parser/interp.sim
浏览文件 @
68c8b30e
...
...
@@ -68,4 +68,19 @@ print ================== server restart completed
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录