Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
df2f7e34
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
df2f7e34
编写于
12月 30, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/develop' into feature/wal
上级
0e2a548e
090df131
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
134 addition
and
23 deletion
+134
-23
src/connector/nodejs/nodetaos/cinterface.js
src/connector/nodejs/nodetaos/cinterface.js
+21
-13
src/connector/nodejs/package.json
src/connector/nodejs/package.json
+1
-1
src/connector/nodejs/test/test.js
src/connector/nodejs/test/test.js
+10
-1
src/inc/taosdef.h
src/inc/taosdef.h
+1
-1
tests/perftest-scripts/perftest-query.sh
tests/perftest-scripts/perftest-query.sh
+7
-1
tests/pytest/functions/function_bottom.py
tests/pytest/functions/function_bottom.py
+16
-0
tests/pytest/functions/function_top.py
tests/pytest/functions/function_top.py
+14
-0
tests/pytest/table/create.py
tests/pytest/table/create.py
+17
-0
tests/pytest/tools/taosdemoPerformance.py
tests/pytest/tools/taosdemoPerformance.py
+31
-5
tests/test-all.sh
tests/test-all.sh
+16
-1
未找到文件。
src/connector/nodejs/nodetaos/cinterface.js
浏览文件 @
df2f7e34
...
...
@@ -367,12 +367,16 @@ CTaosInterface.prototype.fetchBlock = function fetchBlock(result, fields) {
let
offset
=
0
;
for
(
let
i
=
0
;
i
<
fields
.
length
;
i
++
)
{
pdata
=
ref
.
reinterpret
(
pblock
,
8
,
i
*
8
);
if
(
ref
.
isNull
(
pdata
.
readPointer
())){
blocks
[
i
]
=
new
Array
();
}
else
{
pdata
=
ref
.
ref
(
pdata
.
readPointer
());
if
(
!
convertFunctions
[
fields
[
i
][
'
type
'
]]
)
{
throw
new
errors
.
DatabaseError
(
"
Invalid data type returned from database
"
);
}
blocks
[
i
]
=
convertFunctions
[
fields
[
i
][
'
type
'
]](
pdata
,
1
,
fieldlens
[
i
],
offset
,
isMicro
);
}
}
return
{
blocks
:
blocks
,
num_of_rows
:
Math
.
abs
(
num_of_rows
)}
}
CTaosInterface
.
prototype
.
fetchRow
=
function
fetchRow
(
result
,
fields
)
{
...
...
@@ -437,6 +441,9 @@ CTaosInterface.prototype.fetch_rows_a = function fetch_rows_a(result, callback,
}
if
(
numOfRows2
>
0
){
for
(
let
i
=
0
;
i
<
fields
.
length
;
i
++
)
{
if
(
ref
.
isNull
(
pdata
.
readPointer
())){
blocks
[
i
]
=
new
Array
();
}
else
{
if
(
!
convertFunctions
[
fields
[
i
][
'
type
'
]]
)
{
throw
new
errors
.
DatabaseError
(
"
Invalid data type returned from database
"
);
}
...
...
@@ -447,6 +454,7 @@ CTaosInterface.prototype.fetch_rows_a = function fetch_rows_a(result, callback,
//offset += fields[i]['bytes'] * numOfRows2;
}
}
}
callback
(
param2
,
result2
,
numOfRows2
,
blocks
);
}
asyncCallbackWrapper
=
ffi
.
Callback
(
ref
.
types
.
void
,
[
ref
.
types
.
void_ptr
,
ref
.
types
.
void_ptr
,
ref
.
types
.
int
],
asyncCallbackWrapper
);
...
...
src/connector/nodejs/package.json
浏览文件 @
df2f7e34
{
"name"
:
"td2.0-connector"
,
"version"
:
"2.0.
1
"
,
"version"
:
"2.0.
4
"
,
"description"
:
"A Node.js connector for TDengine."
,
"main"
:
"tdengine.js"
,
"scripts"
:
{
...
...
src/connector/nodejs/test/test.js
浏览文件 @
df2f7e34
...
...
@@ -84,10 +84,19 @@ q.execute().then(function(r) {
r
.
pretty
();
});
// test query null value
c1
.
execute
(
"
create table if not exists td_connector_test.weather(ts timestamp, temperature float, humidity int) tags(location nchar(64))
"
);
c1
.
execute
(
"
insert into t1 using weather tags('北京') values(now, 11.11, 11)
"
);
c1
.
execute
(
"
insert into t1(ts, temperature) values(now, 22.22)
"
);
c1
.
execute
(
"
insert into t1(ts, humidity) values(now, 33)
"
);
c1
.
query
(
'
select * from test.t1
'
,
true
).
then
(
function
(
result
)
{
result
.
pretty
();
});
var
q
=
c1
.
query
(
'
select * from td_connector_test.weather
'
);
console
.
log
(
q
.
query
);
q
.
execute
().
then
(
function
(
r
)
{
//console.log(r);
r
.
pretty
();
});
...
...
src/inc/taosdef.h
浏览文件 @
df2f7e34
...
...
@@ -436,7 +436,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf
#define TSDB_PORT_HTTP 11
#define TSDB_PORT_ARBITRATOR 12
#define TSDB_MAX_WAL_SIZE (1024*1024)
#define TSDB_MAX_WAL_SIZE (1024*1024
*2
)
typedef
enum
{
TAOS_QTYPE_RPC
=
0
,
...
...
tests/perftest-scripts/perftest-query.sh
浏览文件 @
df2f7e34
...
...
@@ -74,8 +74,14 @@ function runQueryPerfTest {
CREATETABLETIME
=
`
grep
'Spent'
taosdemoperf.txt |
awk
'NR==1{print $2}'
`
INSERTRECORDSTIME
=
`
grep
'Spent'
taosdemoperf.txt |
awk
'NR==2{print $2}'
`
REQUESTSPERSECOND
=
`
grep
'Spent'
taosdemoperf.txt |
awk
'NR==2{print $13}'
`
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
-t
$CREATETABLETIME
-i
$INSERTRECORDSTIME
-r
$REQUESTSPERSECOND
|
tee
-a
$PERFORMANCE_TEST_REPORT
delay
=
`
grep
'delay'
taosdemoperf.txt |
awk
'{print $4}'
`
AVGDELAY
=
`
echo
${
delay
:0:
${#
delay
}
-3
}
`
delay
=
`
grep
'delay'
taosdemoperf.txt |
awk
'{print $6}'
`
MAXDELAY
=
`
echo
${
delay
:0:
${#
delay
}
-3
}
`
delay
=
`
grep
'delay'
taosdemoperf.txt |
awk
'{print $8}'
`
MINDELAY
=
`
echo
${
delay
:0:
${#
delay
}
-2
}
`
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
-t
$CREATETABLETIME
-i
$INSERTRECORDSTIME
-r
$REQUESTSPERSECOND
-avg
$AVGDELAY
-max
$MAXDELAY
-min
$MINDELAY
|
tee
-a
$PERFORMANCE_TEST_REPORT
[
-f
taosdemoperf.txt
]
&&
rm
taosdemoperf.txt
}
...
...
tests/pytest/functions/function_bottom.py
浏览文件 @
df2f7e34
...
...
@@ -85,6 +85,22 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
0.1
)
tdSql
.
checkData
(
1
,
1
,
1.1
)
#TD-2457 bottom + interval + order by
tdSql
.
error
(
'select top(col2,1) from test interval(1y) order by col2;'
)
#TD-2563 top + super_table + interval
tdSql
.
execute
(
"create table meters(ts timestamp, c int) tags (d int)"
)
tdSql
.
execute
(
"create table t1 using meters tags (1)"
)
sql
=
'insert into t1 values '
for
i
in
range
(
20000
):
sql
=
sql
+
'(%d, %d)'
%
(
self
.
ts
+
i
,
i
%
47
)
if
i
%
2000
==
0
:
tdSql
.
execute
(
sql
)
sql
=
'insert into t1 values '
tdSql
.
execute
(
sql
)
tdSql
.
query
(
'select bottom(c,1) from meters interval(10a)'
)
tdSql
.
checkData
(
0
,
1
,
0
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/functions/function_top.py
浏览文件 @
df2f7e34
...
...
@@ -90,6 +90,20 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
8.1
)
tdSql
.
checkData
(
1
,
1
,
9.1
)
#TD-2563 top + super_table + interval
tdSql
.
execute
(
"create table meters(ts timestamp, c int) tags (d int)"
)
tdSql
.
execute
(
"create table t1 using meters tags (1)"
)
sql
=
'insert into t1 values '
for
i
in
range
(
20000
):
sql
=
sql
+
'(%d, %d)'
%
(
self
.
ts
+
i
,
i
%
47
)
if
i
%
2000
==
0
:
tdSql
.
execute
(
sql
)
sql
=
'insert into t1 values '
tdSql
.
execute
(
sql
)
tdSql
.
query
(
'select top(c,1) from meters interval(10a)'
)
tdSql
.
checkData
(
0
,
1
,
9
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/table/create.py
浏览文件 @
df2f7e34
...
...
@@ -39,6 +39,23 @@ class TDTestCase:
except
Exception
as
e
:
tdLog
.
exit
(
e
)
# case for defect: https://jira.taosdata.com:18080/browse/TD-2560
tdSql
.
execute
(
"create table db.tb02 using st tags(2)"
)
tdSql
.
execute
(
"create table db.tb03 using st tags(3)"
)
tdSql
.
execute
(
"create table db.tb04 using st tags(4)"
)
tdSql
.
query
(
"show tables like 'tb%' "
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"show tables like 'tb0%' "
)
tdSql
.
checkRows
(
3
)
tdSql
.
execute
(
"create table db.st0 (ts timestamp, i int) tags(j int)"
)
tdSql
.
execute
(
"create table db.st1 (ts timestamp, i int, c2 int) tags(j int, loc nchar(20))"
)
tdSql
.
query
(
"show stables like 'st%' "
)
tdSql
.
checkRows
(
3
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoPerformance.py
浏览文件 @
df2f7e34
...
...
@@ -22,12 +22,15 @@ import argparse
import
os.path
class
taosdemoPerformace
:
def
__init__
(
self
,
commitID
,
dbName
,
createTableTime
,
insertRecordsTime
,
recordsPerSecond
):
def
__init__
(
self
,
commitID
,
dbName
,
createTableTime
,
insertRecordsTime
,
recordsPerSecond
,
avgDelay
,
maxDelay
,
minDelay
):
self
.
commitID
=
commitID
self
.
dbName
=
dbName
self
.
createTableTime
=
createTableTime
self
.
insertRecordsTime
=
insertRecordsTime
self
.
recordsPerSecond
=
recordsPerSecond
self
.
avgDelay
=
avgDelay
self
.
maxDelay
=
maxDelay
self
.
minDelay
=
minDelay
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
password
=
"taosdata"
...
...
@@ -43,12 +46,15 @@ class taosdemoPerformace:
cursor
.
execute
(
"create database if not exists %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))"
)
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
)"
)
print
(
"==================== taosdemo performance ===================="
)
print
(
"create tables time: %f"
%
self
.
createTableTime
)
print
(
"insert records time: %f"
%
self
.
insertRecordsTime
)
print
(
"records per second: %f"
%
self
.
recordsPerSecond
)
cursor
.
execute
(
"insert into taosdemo_perf values(now, %f, %f, %f, '%s')"
%
(
self
.
createTableTime
,
self
.
insertRecordsTime
,
self
.
recordsPerSecond
,
self
.
commitID
))
print
(
"avg delay: %f"
%
self
.
avgDelay
)
print
(
"max delay: %f"
%
self
.
maxDelay
)
print
(
"min delay: %f"
%
self
.
minDelay
)
cursor
.
execute
(
"insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f)"
%
(
self
.
createTableTime
,
self
.
insertRecordsTime
,
self
.
recordsPerSecond
,
self
.
commitID
,
self
.
avgDelay
,
self
.
maxDelay
,
self
.
minDelay
))
cursor
.
execute
(
"drop database if exists taosdemo_insert_test"
)
cursor
.
close
()
...
...
@@ -86,8 +92,28 @@ if __name__ == '__main__':
action
=
'store'
,
type
=
float
,
help
=
'records per request'
)
parser
.
add_argument
(
'-avg'
,
'---avg-delay'
,
action
=
'store'
,
type
=
float
,
help
=
'avg delay'
)
parser
.
add_argument
(
'-max'
,
'---max-delay'
,
action
=
'store'
,
type
=
float
,
help
=
'max delay'
)
parser
.
add_argument
(
'-min'
,
'---min-delay'
,
action
=
'store'
,
type
=
float
,
help
=
'min delay'
)
args
=
parser
.
parse_args
()
perftest
=
taosdemoPerformace
(
args
.
commit_id
,
args
.
database_name
,
args
.
create_table
,
args
.
insert_records
,
args
.
records_per_second
)
perftest
=
taosdemoPerformace
(
args
.
commit_id
,
args
.
database_name
,
args
.
create_table
,
args
.
insert_records
,
args
.
records_per_second
,
args
.
avg_delay
,
args
.
max_delay
,
args
.
min_delay
)
perftest
.
createTablesAndStoreData
()
\ No newline at end of file
tests/test-all.sh
浏览文件 @
df2f7e34
...
...
@@ -6,7 +6,16 @@ GREEN='\033[1;32m'
GREEN_DARK
=
'\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
function
git_branch
{
branch
=
"
`
git branch 2>/dev/null |
grep
"^
\*
"
|
sed
-e
"s/^
\*\
//"
`
"
if
[
"
${
branch
}
"
!=
""
]
;
then
if
[
"
${
branch
}
"
=
"(no branch)"
]
;
then
branch
=
"(
`
git rev-parse
--short
HEAD
`
...)"
fi
branch
=(
${
branch
////_
}
)
echo
"
$branch
"
fi
}
function
runSimCaseOneByOne
{
while
read
-r
line
;
do
if
[[
$line
=
~ ^./test.sh
*
]]
||
[[
$line
=
~ ^run
*
]]
;
then
...
...
@@ -44,6 +53,11 @@ function runSimCaseOneByOnefq {
out_log
=
`
tail
-1
out.log
`
if
[[
$out_log
=
~
'failed'
]]
;
then
if
[[
"
$tests_dir
"
==
*
"
$IN_TDINTERNAL
"
*
]]
;
then
cp
-r
../../../sim ~/sim_
$(
git_branch
)
_
`
date
"+%Y_%m_%d_%H:%M:%S"
`
else
cp
-r
../../sim ~/sim_
$(
git_branch
)
_
`
date
"+%Y_%m_%d_%H:%M:%S"
`
fi
exit
8
fi
end_time
=
`
date
+%s
`
...
...
@@ -95,6 +109,7 @@ function runPyCaseOneByOnefq {
end_time
=
`
date
+%s
`
out_log
=
`
tail
-1
pytest-out.log
`
if
[[
$out_log
=
~
'failed'
]]
;
then
cp
-r
../../sim ~/sim_
$(
git_branch
)
_
`
date
"+%Y_%m_%d_%H:%M:%S"
`
exit
8
fi
echo
execution
time
of
$case
was
`
expr
$end_time
-
$start_time
`
s.
|
tee
-a
pytest-out.log
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录