Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cac4cb12
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
cac4cb12
编写于
8月 31, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove assert
上级
d0669151
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
27 deletion
+39
-27
source/libs/index/src/indexFstFile.c
source/libs/index/src/indexFstFile.c
+2
-1
source/libs/transport/src/thttp.c
source/libs/transport/src/thttp.c
+12
-13
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+25
-13
未找到文件。
source/libs/index/src/indexFstFile.c
浏览文件 @
cac4cb12
...
...
@@ -39,7 +39,8 @@ static void idxGenLRUKey(char* buf, const char* path, int32_t blockId) {
}
static
int
idxFileCtxDoWrite
(
IFileCtx
*
ctx
,
uint8_t
*
buf
,
int
len
)
{
if
(
ctx
->
type
==
TFILE
)
{
assert
(
len
==
taosWriteFile
(
ctx
->
file
.
pFile
,
buf
,
len
));
int
nwr
=
taosWriteFile
(
ctx
->
file
.
pFile
,
buf
,
len
);
assert
(
nwr
==
len
);
}
else
{
memcpy
(
ctx
->
mem
.
buf
+
ctx
->
offset
,
buf
,
len
);
}
...
...
source/libs/transport/src/thttp.c
浏览文件 @
cac4cb12
...
...
@@ -21,6 +21,7 @@
#include "taoserror.h"
#include "tlog.h"
// clang-format on
#define HTTP_RECV_BUF_SIZE 1024
...
...
@@ -29,7 +30,7 @@ typedef struct SHttpClient {
uv_tcp_t
tcp
;
uv_write_t
req
;
uv_buf_t
*
wbuf
;
char
*
rbuf
;
char
*
rbuf
;
char
*
addr
;
uint16_t
port
;
}
SHttpClient
;
...
...
@@ -130,37 +131,36 @@ static void destroyHttpClient(SHttpClient* cli) {
taosMemoryFree
(
cli
->
rbuf
);
taosMemoryFree
(
cli
->
addr
);
taosMemoryFree
(
cli
);
}
static
void
clientCloseCb
(
uv_handle_t
*
handle
)
{
SHttpClient
*
cli
=
handle
->
data
;
destroyHttpClient
(
cli
);
}
static
void
clientAllocBuffCb
(
uv_handle_t
*
handle
,
size_t
suggested_size
,
uv_buf_t
*
buf
)
{
SHttpClient
*
cli
=
handle
->
data
;
buf
->
base
=
cli
->
rbuf
;
buf
->
len
=
HTTP_RECV_BUF_SIZE
;
static
void
clientAllocBuffCb
(
uv_handle_t
*
handle
,
size_t
suggested_size
,
uv_buf_t
*
buf
)
{
SHttpClient
*
cli
=
handle
->
data
;
buf
->
base
=
cli
->
rbuf
;
buf
->
len
=
HTTP_RECV_BUF_SIZE
;
}
static
void
clientRecvCb
(
uv_stream_t
*
handle
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
SHttpClient
*
cli
=
handle
->
data
;
static
void
clientRecvCb
(
uv_stream_t
*
handle
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
SHttpClient
*
cli
=
handle
->
data
;
if
(
nread
<
0
)
{
uError
(
"http-report recv error:%s"
,
uv_err_name
(
nread
));
}
else
{
uTrace
(
"http-report succ to recv %d bytes, just ignore it"
,
nread
);
}
uv_close
((
uv_handle_t
*
)
&
cli
->
tcp
,
clientCloseCb
);
}
}
static
void
clientSentCb
(
uv_write_t
*
req
,
int32_t
status
)
{
SHttpClient
*
cli
=
req
->
data
;
if
(
status
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
status
);
uError
(
"http-report failed to send data %s"
,
uv_strerror
(
status
));
uv_close
((
uv_handle_t
*
)
&
cli
->
tcp
,
clientCloseCb
);
return
;
return
;
}
else
{
uTrace
(
"http-report succ to send data"
);
}
uv_read_start
((
uv_stream_t
*
)
&
cli
->
tcp
,
clientAllocBuffCb
,
clientRecvCb
);
uv_read_start
((
uv_stream_t
*
)
&
cli
->
tcp
,
clientAllocBuffCb
,
clientRecvCb
);
}
static
void
clientConnCb
(
uv_connect_t
*
req
,
int32_t
status
)
{
SHttpClient
*
cli
=
req
->
data
;
...
...
@@ -212,7 +212,7 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
cli
->
tcp
.
data
=
cli
;
cli
->
req
.
data
=
cli
;
cli
->
wbuf
=
wb
;
cli
->
rbuf
=
taosMemoryCalloc
(
1
,
HTTP_RECV_BUF_SIZE
);
cli
->
rbuf
=
taosMemoryCalloc
(
1
,
HTTP_RECV_BUF_SIZE
);
cli
->
addr
=
tstrdup
(
server
);
cli
->
port
=
port
;
...
...
@@ -233,4 +233,3 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
uv_loop_close
(
loop
);
return
terrno
;
}
// clang-format on
source/libs/transport/src/transSvr.c
浏览文件 @
cac4cb12
...
...
@@ -906,23 +906,30 @@ static void uvDestroyConn(uv_handle_t* handle) {
}
}
static
void
uvPipeListenCb
(
uv_stream_t
*
handle
,
int
status
)
{
ASSERT
(
status
==
0
);
if
(
status
!=
0
)
{
tError
(
"server failed to init pipe"
);
return
;
}
SServerObj
*
srv
=
container_of
(
handle
,
SServerObj
,
pipeListen
);
uv_pipe_t
*
pipe
=
&
(
srv
->
pipe
[
srv
->
numOfWorkerReady
][
0
]);
ASSERT
(
0
==
uv_pipe_init
(
srv
->
loop
,
pipe
,
1
));
ASSERT
(
0
==
uv_accept
((
uv_stream_t
*
)
&
srv
->
pipeListen
,
(
uv_stream_t
*
)
pipe
));
ASSERT
(
1
==
uv_is_readable
((
uv_stream_t
*
)
pipe
));
ASSERT
(
1
==
uv_is_writable
((
uv_stream_t
*
)
pipe
));
ASSERT
(
0
==
uv_is_closing
((
uv_handle_t
*
)
pipe
));
int
ret
=
uv_pipe_init
(
srv
->
loop
,
pipe
,
1
);
assert
(
ret
==
0
);
srv
->
numOfWorkerReady
++
;
ret
=
uv_accept
((
uv_stream_t
*
)
&
srv
->
pipeListen
,
(
uv_stream_t
*
)
pipe
);
assert
(
ret
==
0
);
ret
=
uv_is_readable
((
uv_stream_t
*
)
pipe
);
assert
(
ret
==
1
);
// ASSERT(0 == uv_listen((uv_stream_t*)&ctx.send.tcp, 512, uvOnAcceptCb));
ret
=
uv_is_writable
((
uv_stream_t
*
)
pipe
);
assert
(
ret
==
1
);
// r = uv_read_start((uv_stream_t*)&ctx.channel, alloc_cb, read_cb);
// ASSERT(r == 0);
ret
=
uv_is_closing
((
uv_handle_t
*
)
pipe
);
assert
(
ret
==
0
);
srv
->
numOfWorkerReady
++
;
}
void
*
transInitServer
(
uint32_t
ip
,
uint32_t
port
,
char
*
label
,
int
numOfThreads
,
void
*
fp
,
void
*
shandle
)
{
...
...
@@ -937,7 +944,9 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
srv
->
port
=
port
;
uv_loop_init
(
srv
->
loop
);
assert
(
0
==
uv_pipe_init
(
srv
->
loop
,
&
srv
->
pipeListen
,
0
));
int
ret
=
uv_pipe_init
(
srv
->
loop
,
&
srv
->
pipeListen
,
0
);
assert
(
ret
==
0
);
#ifdef WINDOWS
char
pipeName
[
64
];
snprintf
(
pipeName
,
sizeof
(
pipeName
),
"
\\\\
?
\\
pipe
\\
trans.rpc.%p-"
PRIu64
,
taosSafeRand
(),
GetCurrentProcessId
());
...
...
@@ -946,8 +955,11 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
snprintf
(
pipeName
,
sizeof
(
pipeName
),
"%s%spipe.trans.rpc.%08X-"
PRIu64
,
tsTempDir
,
TD_DIRSEP
,
taosSafeRand
(),
taosGetSelfPthreadId
());
#endif
assert
(
0
==
uv_pipe_bind
(
&
srv
->
pipeListen
,
pipeName
));
assert
(
0
==
uv_listen
((
uv_stream_t
*
)
&
srv
->
pipeListen
,
SOMAXCONN
,
uvPipeListenCb
));
ret
=
uv_pipe_bind
(
&
srv
->
pipeListen
,
pipeName
);
assert
(
ret
==
0
);
ret
=
uv_listen
((
uv_stream_t
*
)
&
srv
->
pipeListen
,
SOMAXCONN
,
uvPipeListenCb
);
assert
(
ret
==
0
);
for
(
int
i
=
0
;
i
<
srv
->
numOfThreads
;
i
++
)
{
SWorkThrd
*
thrd
=
(
SWorkThrd
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SWorkThrd
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录