Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
41a21ca2
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
41a21ca2
编写于
9月 15, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1225
上级
80eddb19
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
141 addition
and
8 deletion
+141
-8
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-1
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+3
-3
tests/script/general/http/autocreate.sim
tests/script/general/http/autocreate.sim
+5
-0
tests/script/general/http/chunked.sim
tests/script/general/http/chunked.sim
+37
-0
tests/script/general/http/gzip.sim
tests/script/general/http/gzip.sim
+27
-0
tests/script/general/http/testSuite.sim
tests/script/general/http/testSuite.sim
+2
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+2
-0
tests/test/c/cacheTest.c
tests/test/c/cacheTest.c
+7
-4
tests/tsim/inc/sim.h
tests/tsim/inc/sim.h
+2
-0
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+41
-0
tests/tsim/src/simParse.c
tests/tsim/src/simParse.c
+14
-0
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
41a21ca2
...
...
@@ -526,7 +526,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
int32_t
index
=
0
;
SStrToken
sToken
;
int
16
_t
numOfRows
=
0
;
int
32
_t
numOfRows
=
0
;
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMeta
);
...
...
src/plugins/http/src/httpServer.c
浏览文件 @
41a21ca2
...
...
@@ -317,10 +317,10 @@ static bool httpReadData(HttpContext *pContext) {
pContext
->
lastAccessTime
=
taosGetTimestampSec
();
char
buf
[
HTTP_STEP_SIZE
+
1
]
=
{
0
};
int32_t
nread
=
(
int32_t
)
taosReadSocket
(
pContext
->
fd
,
buf
,
sizeof
(
buf
)
);
int32_t
nread
=
(
int32_t
)
taosReadSocket
(
pContext
->
fd
,
buf
,
HTTP_STEP_SIZE
);
if
(
nread
>
0
)
{
buf
[
nread
]
=
'\0'
;
httpTrace
(
"context:%p, fd:%d, nread:%d"
,
pContext
,
pContext
->
fd
,
nread
);
httpTrace
L
(
"context:%p, fd:%d, nread:%d content:%s"
,
pContext
,
pContext
->
fd
,
nread
,
buf
);
int32_t
ok
=
httpParseBuf
(
pParser
,
buf
,
nread
);
if
(
ok
)
{
...
...
@@ -341,7 +341,7 @@ static bool httpReadData(HttpContext *pContext) {
httpTrace
(
"context:%p, fd:%d, read not over yet, len:%d"
,
pContext
,
pContext
->
fd
,
pParser
->
body
.
pos
);
return
false
;
}
else
{
http
TraceL
(
"context:%p, fd:%d, len:%d, body:%s"
,
pContext
,
pContext
->
fd
,
pParser
->
body
.
pos
,
pParser
->
body
.
str
);
http
Debug
(
"context:%p, fd:%d, totalLen:%d"
,
pContext
,
pContext
->
fd
,
pParser
->
body
.
pos
);
return
true
;
}
}
else
if
(
nread
<
0
)
{
...
...
tests/script/general/http/autocreate.sim
浏览文件 @
41a21ca2
...
...
@@ -24,5 +24,10 @@ print curl 127.0.0.1:7111/rest/sql -----> $system_content
# return -1
#endi
sql select * from db.win_cpu_windows_1_processor
print rows: $rows
if $rows != 1 then
return -1
endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
tests/script/general/http/chunked.sim
0 → 100644
浏览文件 @
41a21ca2
system sh/stop_dnodes.sh
sleep 3000
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/cfg.sh -n dnode1 -c http -v 1
system sh/cfg.sh -n dnode1 -c maxSQLLength -v 7340032
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect
print ============================ dnode1 start
print =============== step1 - prepare data
sql create database d1
sql use d1
sql create table table_rest (ts timestamp, i int)
print sql length is 270KB
restful d1 table_rest 1591072800 10000
restful d1 table_rest 1591172800 10000
restful d1 table_rest 1591272800 10000
restful d1 table_rest 1591372800 10000
restful d1 table_rest 1591472800 10000
restful d1 table_rest 1591572800 10000
restful d1 table_rest 1591672800 10000
restful d1 table_rest 1591772800 10000
restful d1 table_rest 1591872800 10000
restful d1 table_rest 1591972800 10000
sql select * from table_rest;
print rows: $rows
if $rows != 100000 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
tests/script/general/http/gzip.sim
0 → 100644
浏览文件 @
41a21ca2
system sh/stop_dnodes.sh
sleep 3000
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/cfg.sh -n dnode1 -c http -v 1
system sh/cfg.sh -n dnode1 -c maxSQLLength -v 7340032
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect
print ============================ dnode1 start
print =============== step1 - prepare data
sql create database d1
sql use d1
sql create table table_rest (ts timestamp, i int)
print sql length is 270KB
restful d1 table_rest 1591072800 10000 gzip
sql select * from table_rest;
print rows: $rows
if $rows != 10000 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
tests/script/general/http/testSuite.sim
浏览文件 @
41a21ca2
run general/http/autocreate.sim
run general/http/chunked.sim
run general/http/restful.sim
run general/http/restful_insert.sim
run general/http/restful_limit.sim
...
...
tests/script/jenkins/basic.txt
浏览文件 @
41a21ca2
...
...
@@ -77,6 +77,8 @@ cd ../../../debug; make
./test.sh -f general/field/smallint.sim
./test.sh -f general/field/tinyint.sim
./test.sh -f general/http/autocreate.sim
./test.sh -f general/http/chunked.sim
./test.sh -f general/http/restful.sim
./test.sh -f general/http/restful_insert.sim
./test.sh -f general/http/restful_limit.sim
...
...
tests/test/c/cacheTest.c
浏览文件 @
41a21ca2
...
...
@@ -14,6 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include <malloc.h>
#include "os.h"
#include "taos.h"
#include "tcache.h"
...
...
@@ -91,15 +92,17 @@ void doTest() {
putRowInCache
();
pPrint
(
"%s insert %d rows, procMemory %f MB %s"
,
GREEN
,
tsNumOfRows
,
getProcMemory
(),
NC
);
int32_t
sleepMs
=
(
MAX_REFRESH_TIME_SEC
*
3
+
10
)
*
1000
+
tsKeepTimeInSec
*
1000
;
int32_t
sleepMs
=
(
MAX_REFRESH_TIME_SEC
*
3
)
*
1000
+
tsKeepTimeInSec
*
1000
;
taosMsleep
(
sleepMs
);
pPrint
(
"%s after sleep %d ms, procMemory %f MB %s"
,
GREEN
,
sleepMs
,
getProcMemory
(),
NC
);
//
cleanupCache();
cleanupCache
();
taosMsleep
(
sleepMs
);
pPrint
(
"%s after cleanup cache, procMemory %f MB %s"
,
GREEN
,
getProcMemory
(),
NC
);
pPrint
(
"%s finally destroyTimes:%d %s"
,
GREEN
,
destroyTimes
,
NC
);
malloc_trim
(
0
);
taosMsleep
(
sleepMs
);
pPrint
(
"%s after malloc_trim, procMemory %f MB %s"
,
GREEN
,
getProcMemory
(),
NC
);
}
void
printHelp
()
{
...
...
tests/tsim/inc/sim.h
浏览文件 @
41a21ca2
...
...
@@ -84,6 +84,7 @@ enum {
SIM_CMD_SQL
,
SIM_CMD_SQL_ERROR
,
SIM_CMD_SQL_SLOW
,
SIM_CMD_RESTFUL
,
SIM_CMD_TEST
,
SIM_CMD_RETURN
,
SIM_CMD_END
...
...
@@ -172,6 +173,7 @@ bool simExecuteReturnCmd(SScript *script, char *option);
bool
simExecuteSqlCmd
(
SScript
*
script
,
char
*
option
);
bool
simExecuteSqlErrorCmd
(
SScript
*
script
,
char
*
rest
);
bool
simExecuteSqlSlowCmd
(
SScript
*
script
,
char
*
option
);
bool
simExecuteRestfulCmd
(
SScript
*
script
,
char
*
rest
);
void
simVisuallizeOption
(
SScript
*
script
,
char
*
src
,
char
*
dst
);
#endif
\ No newline at end of file
tests/tsim/src/simExe.c
浏览文件 @
41a21ca2
...
...
@@ -915,6 +915,47 @@ bool simExecuteSqlSlowCmd(SScript *script, char *rest) {
return
simExecuteSqlImpCmd
(
script
,
rest
,
isSlow
);
}
bool
simExecuteRestfulCmd
(
SScript
*
script
,
char
*
rest
)
{
FILE
*
fp
=
NULL
;
char
filename
[
256
];
sprintf
(
filename
,
"%s/tmp.sql"
,
tsScriptDir
);
fp
=
fopen
(
filename
,
"w"
);
if
(
fp
==
NULL
)
{
fprintf
(
stderr
,
"ERROR: failed to open file: %s
\n
"
,
filename
);
return
false
;
}
char
db
[
64
]
=
{
0
};
char
tb
[
64
]
=
{
0
};
char
gzip
[
32
]
=
{
0
};
int32_t
ts
;
int32_t
times
;
sscanf
(
rest
,
"%s %s %d %d %s"
,
db
,
tb
,
&
ts
,
&
times
,
gzip
);
fprintf
(
fp
,
"insert into %s.%s values "
,
db
,
tb
);
for
(
int
i
=
0
;
i
<
times
;
++
i
)
{
fprintf
(
fp
,
"(%d000, %d)"
,
ts
+
i
,
ts
);
}
fprintf
(
fp
,
"
\n
"
);
fflush
(
fp
);
fclose
(
fp
);
char
cmd
[
1024
]
=
{
0
};
if
(
strcmp
(
gzip
,
"gzip"
)
==
0
)
{
sprintf
(
cmd
,
"curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' --header "
"--compressed --data-ascii @%s 127.0.0.1:7111/rest/sql"
,
filename
);
}
else
{
sprintf
(
cmd
,
"curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' --header "
"'Transfer-Encoding: chunked' --data-ascii @%s 127.0.0.1:7111/rest/sql"
,
filename
);
}
return
simExecuteSystemCmd
(
script
,
cmd
);
}
bool
simExecuteSqlErrorCmd
(
SScript
*
script
,
char
*
rest
)
{
char
buf
[
3000
];
SCmdLine
*
line
=
&
script
->
lines
[
script
->
linePos
];
...
...
tests/tsim/src/simParse.c
浏览文件 @
41a21ca2
...
...
@@ -721,6 +721,12 @@ bool simParseSqlSlowCmd(char *rest, SCommand *pCmd, int lineNum) {
return
true
;
}
bool
simParseRestfulCmd
(
char
*
rest
,
SCommand
*
pCmd
,
int
lineNum
)
{
simParseSqlCmd
(
rest
,
pCmd
,
lineNum
);
cmdLine
[
numOfLines
-
1
].
cmdno
=
SIM_CMD_RESTFUL
;
return
true
;
}
bool
simParseSystemCmd
(
char
*
rest
,
SCommand
*
pCmd
,
int
lineNum
)
{
int
expLen
;
...
...
@@ -1020,6 +1026,14 @@ void simInitsimCmdList() {
simCmdList
[
cmdno
].
executeCmd
=
simExecuteSqlSlowCmd
;
simAddCmdIntoHash
(
&
(
simCmdList
[
cmdno
]));
cmdno
=
SIM_CMD_RESTFUL
;
simCmdList
[
cmdno
].
cmdno
=
cmdno
;
strcpy
(
simCmdList
[
cmdno
].
name
,
"restful"
);
simCmdList
[
cmdno
].
nlen
=
(
int16_t
)
strlen
(
simCmdList
[
cmdno
].
name
);
simCmdList
[
cmdno
].
parseCmd
=
simParseRestfulCmd
;
simCmdList
[
cmdno
].
executeCmd
=
simExecuteRestfulCmd
;
simAddCmdIntoHash
(
&
(
simCmdList
[
cmdno
]));
/* test is only an internal command */
cmdno
=
SIM_CMD_TEST
;
simCmdList
[
cmdno
].
cmdno
=
cmdno
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录