Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f41bd569
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f41bd569
编写于
4月 28, 2022
作者:
dengyihao
提交者:
GitHub
4月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11988 from taosdata/feature/refator_retry
refactor(rpc): fefactor retry way
上级
fde3f3f6
b83963ab
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
14 addition
and
19 deletion
+14
-19
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+3
-4
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+5
-5
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+6
-10
未找到文件。
source/libs/transport/inc/transComm.h
浏览文件 @
f41bd569
...
@@ -348,14 +348,13 @@ typedef struct SDelayQueue {
...
@@ -348,14 +348,13 @@ typedef struct SDelayQueue {
uv_timer_t
*
timer
;
uv_timer_t
*
timer
;
Heap
*
heap
;
Heap
*
heap
;
uv_loop_t
*
loop
;
uv_loop_t
*
loop
;
void
(
*
free
)(
void
*
arg
);
}
SDelayQueue
;
}
SDelayQueue
;
int
trans
CreateDelayQueu
e
(
uv_loop_t
*
loop
,
SDelayQueue
**
queue
);
int
trans
DQCreat
e
(
uv_loop_t
*
loop
,
SDelayQueue
**
queue
);
void
transD
estroyDelayQueue
(
SDelayQueue
*
queue
);
void
transD
QDestroy
(
SDelayQueue
*
queue
);
int
trans
PutTaskToDelayQueue
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
);
int
trans
DQSched
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
);
/*
/*
* init global func
* init global func
...
...
source/libs/transport/src/transCli.c
浏览文件 @
f41bd569
...
@@ -842,7 +842,7 @@ static SCliThrdObj* createThrdObj() {
...
@@ -842,7 +842,7 @@ static SCliThrdObj* createThrdObj() {
pThrd
->
pool
=
createConnPool
(
4
);
pThrd
->
pool
=
createConnPool
(
4
);
trans
CreateDelayQueu
e
(
pThrd
->
loop
,
&
pThrd
->
delayQueue
);
trans
DQCreat
e
(
pThrd
->
loop
,
&
pThrd
->
delayQueue
);
pThrd
->
quit
=
false
;
pThrd
->
quit
=
false
;
return
pThrd
;
return
pThrd
;
...
@@ -857,7 +857,7 @@ static void destroyThrdObj(SCliThrdObj* pThrd) {
...
@@ -857,7 +857,7 @@ static void destroyThrdObj(SCliThrdObj* pThrd) {
taosThreadMutexDestroy
(
&
pThrd
->
msgMtx
);
taosThreadMutexDestroy
(
&
pThrd
->
msgMtx
);
transDestroyAsyncPool
(
pThrd
->
asyncPool
);
transDestroyAsyncPool
(
pThrd
->
asyncPool
);
transD
estroyDelayQueue
(
pThrd
->
delayQueue
);
transD
QDestroy
(
pThrd
->
delayQueue
);
taosMemoryFree
(
pThrd
->
loop
);
taosMemoryFree
(
pThrd
->
loop
);
taosMemoryFree
(
pThrd
);
taosMemoryFree
(
pThrd
);
}
}
...
@@ -923,14 +923,14 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
...
@@ -923,14 +923,14 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
STaskArg
*
arg
=
taosMemoryMalloc
(
sizeof
(
STaskArg
));
STaskArg
*
arg
=
taosMemoryMalloc
(
sizeof
(
STaskArg
));
arg
->
param1
=
pMsg
;
arg
->
param1
=
pMsg
;
arg
->
param2
=
pThrd
;
arg
->
param2
=
pThrd
;
trans
PutTaskToDelayQueue
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
TRANS_RETRY_INTERVAL
);
trans
DQSched
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
TRANS_RETRY_INTERVAL
);
cliDestroy
((
uv_handle_t
*
)
pConn
->
stream
);
cliDestroy
((
uv_handle_t
*
)
pConn
->
stream
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
pCtx
->
retryCount
<
TRANS_RETRY_COUNT_LIMIT
)
{
}
else
if
(
pCtx
->
retryCount
<
TRANS_RETRY_COUNT_LIMIT
)
{
if
(
pResp
->
contLen
==
0
)
{
if
(
pResp
->
contLen
==
0
)
{
pEpSet
->
inUse
=
(
pEpSet
->
inUse
++
)
%
pEpSet
->
numOfEps
;
pEpSet
->
inUse
=
(
++
pEpSet
->
inUse
)
%
pEpSet
->
numOfEps
;
}
else
{
}
else
{
SMEpSet
emsg
=
{
0
};
SMEpSet
emsg
=
{
0
};
tDeserializeSMEpSet
(
pResp
->
pCont
,
pResp
->
contLen
,
&
emsg
);
tDeserializeSMEpSet
(
pResp
->
pCont
,
pResp
->
contLen
,
&
emsg
);
...
@@ -940,7 +940,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
...
@@ -940,7 +940,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
arg
->
param1
=
pMsg
;
arg
->
param1
=
pMsg
;
arg
->
param2
=
pThrd
;
arg
->
param2
=
pThrd
;
trans
PutTaskToDelayQueue
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
TRANS_RETRY_INTERVAL
);
trans
DQSched
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
TRANS_RETRY_INTERVAL
);
addConnToPool
(
pThrd
,
pConn
);
addConnToPool
(
pThrd
,
pConn
);
return
-
1
;
return
-
1
;
}
}
...
...
source/libs/transport/src/transComm.c
浏览文件 @
f41bd569
...
@@ -369,7 +369,7 @@ static int32_t timeCompare(const HeapNode* a, const HeapNode* b) {
...
@@ -369,7 +369,7 @@ static int32_t timeCompare(const HeapNode* a, const HeapNode* b) {
}
}
}
}
static
void
transD
elayQueue
Timeout
(
uv_timer_t
*
timer
)
{
static
void
transD
Q
Timeout
(
uv_timer_t
*
timer
)
{
SDelayQueue
*
queue
=
timer
->
data
;
SDelayQueue
*
queue
=
timer
->
data
;
tTrace
(
"timer %p timeout"
,
timer
);
tTrace
(
"timer %p timeout"
,
timer
);
uint64_t
timeout
=
0
;
uint64_t
timeout
=
0
;
...
@@ -388,10 +388,10 @@ static void transDelayQueueTimeout(uv_timer_t* timer) {
...
@@ -388,10 +388,10 @@ static void transDelayQueueTimeout(uv_timer_t* timer) {
}
}
}
while
(
1
);
}
while
(
1
);
if
(
timeout
!=
0
)
{
if
(
timeout
!=
0
)
{
uv_timer_start
(
queue
->
timer
,
transD
elayQueue
Timeout
,
timeout
,
0
);
uv_timer_start
(
queue
->
timer
,
transD
Q
Timeout
,
timeout
,
0
);
}
}
}
}
int
trans
CreateDelayQueu
e
(
uv_loop_t
*
loop
,
SDelayQueue
**
queue
)
{
int
trans
DQCreat
e
(
uv_loop_t
*
loop
,
SDelayQueue
**
queue
)
{
uv_timer_t
*
timer
=
taosMemoryCalloc
(
1
,
sizeof
(
uv_timer_t
));
uv_timer_t
*
timer
=
taosMemoryCalloc
(
1
,
sizeof
(
uv_timer_t
));
uv_timer_init
(
loop
,
timer
);
uv_timer_init
(
loop
,
timer
);
...
@@ -407,7 +407,7 @@ int transCreateDelayQueue(uv_loop_t* loop, SDelayQueue** queue) {
...
@@ -407,7 +407,7 @@ int transCreateDelayQueue(uv_loop_t* loop, SDelayQueue** queue) {
return
0
;
return
0
;
}
}
void
transD
estroyDelayQueue
(
SDelayQueue
*
queue
)
{
void
transD
QDestroy
(
SDelayQueue
*
queue
)
{
taosMemoryFree
(
queue
->
timer
);
taosMemoryFree
(
queue
->
timer
);
while
(
heapSize
(
queue
->
heap
)
>
0
)
{
while
(
heapSize
(
queue
->
heap
)
>
0
)
{
...
@@ -424,19 +424,15 @@ void transDestroyDelayQueue(SDelayQueue* queue) {
...
@@ -424,19 +424,15 @@ void transDestroyDelayQueue(SDelayQueue* queue) {
taosMemoryFree
(
queue
);
taosMemoryFree
(
queue
);
}
}
int
trans
PutTaskToDelayQueue
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
)
{
int
trans
DQSched
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
)
{
SDelayTask
*
task
=
taosMemoryCalloc
(
1
,
sizeof
(
SDelayTask
));
SDelayTask
*
task
=
taosMemoryCalloc
(
1
,
sizeof
(
SDelayTask
));
task
->
func
=
func
;
task
->
func
=
func
;
task
->
arg
=
arg
;
task
->
arg
=
arg
;
task
->
execTime
=
taosGetTimestampMs
()
+
timeoutMs
;
task
->
execTime
=
taosGetTimestampMs
()
+
timeoutMs
;
tTrace
(
"timer %p put task into queue, timeoutMs: %"
PRIu64
""
,
queue
->
timer
,
timeoutMs
);
tTrace
(
"timer %p put task into queue, timeoutMs: %"
PRIu64
""
,
queue
->
timer
,
timeoutMs
);
heapInsert
(
queue
->
heap
,
&
task
->
node
);
heapInsert
(
queue
->
heap
,
&
task
->
node
);
if
(
heapSize
(
queue
->
heap
)
==
1
)
{
uv_timer_start
(
queue
->
timer
,
transDQTimeout
,
timeoutMs
,
0
);
uv_timer_start
(
queue
->
timer
,
transDelayQueueTimeout
,
timeoutMs
,
0
);
}
return
0
;
return
0
;
}
}
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录