Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b894ba6f
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看板
提交
b894ba6f
编写于
2月 17, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt trans
上级
597d7d3d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
30 deletion
+33
-30
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+33
-30
未找到文件。
source/libs/transport/src/transCli.c
浏览文件 @
b894ba6f
...
...
@@ -159,11 +159,9 @@ static void cliIdleCb(uv_idle_t* handle);
static
void
cliPrepareCb
(
uv_prepare_t
*
handle
);
static
void
cliHandleBatchReq
(
SCliBatch
*
pBatch
,
SCliThrd
*
pThrd
);
// static void cliConnBatchCb(uv_connect_t* req, int status);
static
void
cliSendBatchCb
(
uv_write_t
*
req
,
int
status
);
// static void cliConnBatchCb(uv_connect_t* req, int status);
// callback after conn to server
// static void cliConnBatchCb(uv_connect_t* req, int status);
SCliBatch
*
cliGetHeadFromList
(
SCliBatchList
*
pList
);
static
bool
cliRecvReleaseReq
(
SCliConn
*
conn
,
STransMsgHead
*
pHead
);
...
...
@@ -847,8 +845,11 @@ void cliSendBatch(SCliConn* pConn) {
SCliThrd
*
pThrd
=
pConn
->
hostThrd
;
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
SCliBatch
*
pBatch
=
pConn
->
pBatch
;
int32_t
wLen
=
pBatch
->
wLen
;
SCliBatch
*
pBatch
=
pConn
->
pBatch
;
SCliBatchList
*
pList
=
pBatch
->
pList
;
pList
->
connCnt
+=
1
;
int32_t
wLen
=
pBatch
->
wLen
;
uv_buf_t
*
wb
=
taosMemoryCalloc
(
wLen
,
sizeof
(
uv_buf_t
));
int
i
=
0
;
...
...
@@ -994,7 +995,7 @@ static void cliDestroyBatch(SCliBatch* pBatch) {
taosMemoryFree
(
pBatch
);
}
static
void
cliHandleBatchReq
(
SCliBatch
*
pBatch
,
SCliThrd
*
pThrd
)
{
if
(
pBatch
->
wLen
==
0
||
QUEUE_IS_EMPTY
(
&
pBatch
->
wq
))
{
if
(
pBatch
==
NULL
||
pBatch
->
wLen
==
0
||
QUEUE_IS_EMPTY
(
&
pBatch
->
wq
))
{
return
;
}
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
...
...
@@ -1071,8 +1072,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) {
SCliBatch
*
p
=
conn
->
pBatch
;
SCliBatchList
*
pBatchList
=
p
->
pList
;
int32_t
empty
=
QUEUE_IS_EMPTY
(
&
pBatchList
->
wq
);
SCliBatch
*
nxtBatch
=
cliGetHeadFromList
(
pBatchList
);
pBatchList
->
connCnt
-=
1
;
conn
->
pBatch
=
NULL
;
...
...
@@ -1081,23 +1081,17 @@ static void cliSendBatchCb(uv_write_t* req, int status) {
tDebug
(
"%s conn %p failed to send batch msg, batch size:%d, msgLen:%d, reason:%s"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
p
->
wLen
,
p
->
batchSize
,
uv_err_name
(
status
));
cliHandleExcept
(
conn
);
cliHandleBatchReq
(
nxtBatch
,
thrd
);
}
else
{
tDebug
(
"%s conn %p succ to send batch msg, batch size:%d, msgLen:%d"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
p
->
wLen
,
p
->
batchSize
);
if
(
empty
==
false
)
{
queue
*
h
=
QUEUE_HEAD
(
&
pBatchList
->
wq
);
QUEUE_REMOVE
(
h
);
conn
->
pBatch
=
QUEUE_DATA
(
h
,
SCliBatch
,
listq
);
pBatchList
->
connCnt
+=
1
;
pBatchList
->
len
-=
1
;
if
(
nxtBatch
!=
NULL
)
{
conn
->
pBatch
=
nxtBatch
;
cliSendBatch
(
conn
);
return
;
}
else
{
addConnToPool
(
thrd
->
pool
,
conn
);
}
addConnToPool
(
thrd
->
pool
,
conn
);
}
cliDestroyBatch
(
p
);
...
...
@@ -1466,6 +1460,18 @@ static void cliNoBatchDealReq(queue* wq, SCliThrd* pThrd) {
tTrace
(
"cli process batch size:%d"
,
count
);
}
}
SCliBatch
*
cliGetHeadFromList
(
SCliBatchList
*
pList
)
{
if
(
QUEUE_IS_EMPTY
(
&
pList
->
wq
)
||
pList
->
connCnt
>=
pList
->
connMax
)
{
return
NULL
;
}
queue
*
hr
=
QUEUE_HEAD
(
&
pList
->
wq
);
QUEUE_REMOVE
(
hr
);
pList
->
len
-=
1
;
SCliBatch
*
batch
=
QUEUE_DATA
(
hr
,
SCliBatch
,
listq
);
return
batch
;
}
static
void
cliBatchDealReq
(
queue
*
wq
,
SCliThrd
*
pThrd
)
{
int
count
=
0
;
...
...
@@ -1528,6 +1534,7 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
if
((
pBatch
->
batchSize
+
pMsg
->
msg
.
contLen
)
<
(
*
ppBatchList
)
->
batchLenLimit
)
{
QUEUE_PUSH
(
&
pBatch
->
wq
,
h
);
pBatch
->
batchSize
+=
pMsg
->
msg
.
contLen
;
pBatch
->
wLen
+=
1
;
}
else
{
SCliBatch
*
pBatch
=
taosMemoryCalloc
(
1
,
sizeof
(
SCliBatch
));
QUEUE_INIT
(
&
pBatch
->
wq
);
...
...
@@ -1551,17 +1558,10 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
void
**
pIter
=
taosHashIterate
(
pThrd
->
batchCache
,
NULL
);
while
(
pIter
!=
NULL
)
{
SCliBatchList
*
batchList
=
(
SCliBatchList
*
)(
*
pIter
);
if
(
QUEUE_IS_EMPTY
(
&
batchList
->
wq
)
||
batchList
->
connCnt
>=
batchList
->
connMax
)
{
continue
;
SCliBatch
*
batch
=
cliGetHeadFromList
(
batchList
);
if
(
batch
!=
NULL
)
{
cliHandleBatchReq
(
batch
,
pThrd
);
}
queue
*
hr
=
QUEUE_HEAD
(
&
batchList
->
wq
);
QUEUE_REMOVE
(
hr
);
batchList
->
len
-=
1
;
SCliBatch
*
batch
=
QUEUE_DATA
(
hr
,
SCliBatch
,
listq
);
cliHandleBatchReq
(
batch
,
pThrd
);
pIter
=
(
void
**
)
taosHashIterate
(
pThrd
->
batchCache
,
pIter
);
}
...
...
@@ -1848,7 +1848,10 @@ static void destroyThrdObj(SCliThrd* pThrd) {
SCliBatch
*
pBatch
=
QUEUE_DATA
(
h
,
SCliBatch
,
listq
);
cliDestroyBatch
(
pBatch
);
}
taosMemoryFree
(
pBatchList
->
ip
);
taosMemoryFree
(
pBatchList
->
dst
);
taosMemoryFree
(
pBatchList
);
pIter
=
(
void
**
)
taosHashIterate
(
pThrd
->
batchCache
,
pIter
);
}
taosHashCleanup
(
pThrd
->
batchCache
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录