Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4bf444a1
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看板
未验证
提交
4bf444a1
编写于
9月 22, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
9月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3631 from taosdata/feature/crash
Feature/crash
上级
145f67c6
07961464
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
32 addition
and
13 deletion
+32
-13
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-1
src/plugins/http/inc/httpJson.h
src/plugins/http/inc/httpJson.h
+1
-1
src/plugins/http/src/httpJson.c
src/plugins/http/src/httpJson.c
+5
-5
src/plugins/http/src/httpUtil.c
src/plugins/http/src/httpUtil.c
+10
-4
tests/script/general/http/gzip.sim
tests/script/general/http/gzip.sim
+14
-2
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
未找到文件。
src/common/src/tglobal.c
浏览文件 @
4bf444a1
...
...
@@ -131,7 +131,7 @@ uint16_t tsHttpPort = 6041; // only tcp, range tcp[6041]
int32_t
tsHttpCacheSessions
=
1000
;
int32_t
tsHttpSessionExpire
=
36000
;
int32_t
tsHttpMaxThreads
=
2
;
int32_t
tsHttpEnableCompress
=
0
;
int32_t
tsHttpEnableCompress
=
1
;
int32_t
tsHttpEnableRecordSql
=
0
;
int32_t
tsTelegrafUseFieldNum
=
0
;
...
...
src/plugins/http/inc/httpJson.h
浏览文件 @
4bf444a1
...
...
@@ -19,7 +19,7 @@
#include <stdint.h>
#include <stdbool.h>
#define JSON_BUFFER_SIZE 1
0240
#define JSON_BUFFER_SIZE 1
6384
struct
HttpContext
;
enum
{
JsonNumber
,
JsonString
,
JsonBoolean
,
JsonArray
,
JsonObject
,
JsonNull
};
...
...
src/plugins/http/src/httpJson.c
浏览文件 @
4bf444a1
...
...
@@ -52,12 +52,12 @@ int32_t httpWriteBufByFd(struct HttpContext* pContext, const char* buf, int32_t
}
if
(
len
<
0
)
{
httpDebug
(
"context:%p, fd:%d, socket write errno:%d
, times:%d"
,
pContext
,
pContext
->
fd
,
errno
,
countWait
);
httpDebug
(
"context:%p, fd:%d, socket write errno:%d
:%s, times:%d"
,
pContext
,
pContext
->
fd
,
errno
,
strerror
(
errno
)
,
countWait
);
if
(
++
countWait
>
HTTP_WRITE_RETRY_TIMES
)
break
;
taosMsleep
(
HTTP_WRITE_WAIT_TIME_MS
);
continue
;
}
else
if
(
len
==
0
)
{
httpDebug
(
"context:%p, fd:%d, socket write errno:%d
, connect already closed"
,
pContext
,
pContext
->
fd
,
errno
);
httpDebug
(
"context:%p, fd:%d, socket write errno:%d
:%s, connect already closed"
,
pContext
,
pContext
->
fd
,
errno
,
strerror
(
errno
)
);
break
;
}
else
{
countWait
=
0
;
...
...
@@ -131,14 +131,14 @@ int32_t httpWriteJsonBufBody(JsonBuf* buf, bool isTheLast) {
httpWriteBufNoTrace
(
buf
->
pContext
,
sLen
,
len
);
remain
=
httpWriteBufNoTrace
(
buf
->
pContext
,
(
const
char
*
)
compressBuf
,
compressBufLen
);
}
else
{
http
Trace
(
"context:%p, fd:%d, last:%d, compress already dumped, response:
\n
%s"
,
buf
->
pContext
,
http
Debug
(
"context:%p, fd:%d, last:%d, compress already dumped, response:
\n
%s"
,
buf
->
pContext
,
buf
->
pContext
->
fd
,
isTheLast
,
buf
->
buf
);
re
turn
0
;
// there is no data to dump.
re
main
=
0
;
// there is no data to dump.
}
}
else
{
httpError
(
"context:%p, fd:%d, failed to compress data, chunkSize:%"
PRIu64
", last:%d, error:%d, response:
\n
%s"
,
buf
->
pContext
,
buf
->
pContext
->
fd
,
srcLen
,
isTheLast
,
ret
,
buf
->
buf
);
re
turn
0
;
re
main
=
0
;
}
}
...
...
src/plugins/http/src/httpUtil.c
浏览文件 @
4bf444a1
...
...
@@ -406,15 +406,21 @@ int32_t httpGzipCompressInit(HttpContext *pContext) {
int32_t
httpGzipCompress
(
HttpContext
*
pContext
,
char
*
srcData
,
int32_t
nSrcData
,
char
*
destData
,
int32_t
*
nDestData
,
bool
isTheLast
)
{
int32_t
err
=
0
;
int32_t
lastTotalLen
=
(
int32_t
)
(
pContext
->
gzipStream
.
total_out
);
pContext
->
gzipStream
.
next_in
=
(
Bytef
*
)
srcData
;
pContext
->
gzipStream
.
avail_in
=
(
uLong
)
nSrcData
;
pContext
->
gzipStream
.
next_out
=
(
Bytef
*
)
destData
;
pContext
->
gzipStream
.
avail_out
=
(
uLong
)
(
*
nDestData
);
while
(
pContext
->
gzipStream
.
avail_in
!=
0
&&
pContext
->
gzipStream
.
total_out
<
(
uLong
)
(
*
nDestData
)
)
{
while
(
pContext
->
gzipStream
.
avail_in
!=
0
)
{
if
(
deflate
(
&
pContext
->
gzipStream
,
Z_FULL_FLUSH
)
!=
Z_OK
)
{
return
-
1
;
}
int32_t
cacheLen
=
pContext
->
gzipStream
.
total_out
-
lastTotalLen
;
if
(
cacheLen
>=
*
nDestData
)
{
return
-
2
;
}
}
if
(
pContext
->
gzipStream
.
avail_in
!=
0
)
{
...
...
@@ -427,16 +433,16 @@ int32_t httpGzipCompress(HttpContext *pContext, char *srcData, int32_t nSrcData,
break
;
}
if
(
err
!=
Z_OK
)
{
return
-
2
;
return
-
3
;
}
}
if
(
deflateEnd
(
&
pContext
->
gzipStream
)
!=
Z_OK
)
{
return
-
3
;
return
-
4
;
}
}
*
nDestData
=
(
int32_t
)
(
pContext
->
gzipStream
.
total_out
);
*
nDestData
=
(
int32_t
)
(
pContext
->
gzipStream
.
total_out
)
-
lastTotalLen
;
return
0
;
}
...
...
tests/script/general/http/gzip.sim
浏览文件 @
4bf444a1
...
...
@@ -3,7 +3,7 @@ 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
7
340032
system sh/cfg.sh -n dnode1 -c maxSQLLength -v 340032
system sh/exec.sh -n dnode1 -s start
sleep 3000
...
...
@@ -18,10 +18,22 @@ sql use d1
sql create table table_rest (ts timestamp, i int)
print sql length is 270KB
restful d1 table_rest 1591072800 10000 gzip
restful d1 table_rest 1591172800 10000 gzip
restful d1 table_rest 1591272800 10000 gzip
restful d1 table_rest 1591372800 10000 gzip
restful d1 table_rest 1591472800 10000 gzip
restful d1 table_rest 1591572800 10000 gzip
restful d1 table_rest 1591672800 10000 gzip
restful d1 table_rest 1591772800 10000 gzip
restful d1 table_rest 1591872800 10000 gzip
restful d1 table_rest 1591972800 10000 gzip
sql select * from table_rest;
print rows: $rows
if $rows != 10000 then
if $rows != 10000
0
then
return -1
endi
system curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql --compressed
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
tests/script/jenkins/basic.txt
浏览文件 @
4bf444a1
...
...
@@ -79,6 +79,7 @@ cd ../../../debug; make
./test.sh -f general/http/autocreate.sim
./test.sh -f general/http/chunked.sim
./test.sh -f general/http/gzip.sim
./test.sh -f general/http/restful.sim
./test.sh -f general/http/restful_insert.sim
./test.sh -f general/http/restful_limit.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录