Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a7ad2990
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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,发现更多精彩内容 >>
未验证
提交
a7ad2990
编写于
2月 24, 2023
作者:
H
Haojun Liao
提交者:
GitHub
2月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20142 from taosdata/enh/optTrans
fix: opt trans debug info
上级
be0e4b53
f6ca06ef
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
25 deletion
+30
-25
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+1
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+29
-25
未找到文件。
source/libs/transport/inc/transComm.h
浏览文件 @
a7ad2990
...
...
@@ -22,6 +22,7 @@ extern "C" {
#include "os.h"
#include "taoserror.h"
#include "theap.h"
#include "tmisce.h"
#include "transLog.h"
#include "transportInt.h"
#include "trpc.h"
...
...
source/libs/transport/src/transCli.c
浏览文件 @
a7ad2990
...
...
@@ -11,7 +11,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transComm.h"
typedef
struct
SConnList
{
...
...
@@ -224,9 +223,13 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
} while (0);
// snprintf may cause performance problem
#define CONN_CONSTRUCT_HASH_KEY(key, ip, port) \
do { \
snprintf(key, sizeof(key), "%s:%d", ip, (int)port); \
#define CONN_CONSTRUCT_HASH_KEY(key, ip, port) \
do { \
char* p = key; \
int32_t len = strlen(ip); \
if (p != NULL) memcpy(p, ip, len); \
p[len] = ':'; \
titoa(port, 10, &p[len + 1]); \
} while (0)
#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
...
...
@@ -664,7 +667,7 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) {
static
void
cliAllocRecvBufferCb
(
uv_handle_t
*
handle
,
size_t
suggested_size
,
uv_buf_t
*
buf
)
{
SCliConn
*
conn
=
handle
->
data
;
SConnBuffer
*
pBuf
=
&
conn
->
readBuf
;
t
Debug
(
"%s conn %p alloc read buf"
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
t
Trace
(
"%s conn %p alloc read buf"
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
transAllocBuffer
(
pBuf
,
buf
);
}
static
void
cliRecvCb
(
uv_stream_t
*
handle
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
...
...
@@ -677,7 +680,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
if
(
nread
>
0
)
{
pBuf
->
len
+=
nread
;
while
(
transReadComplete
(
pBuf
))
{
t
Debug
(
"%s conn %p read complete"
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
t
Trace
(
"%s conn %p read complete"
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
if
(
pBuf
->
invalid
)
{
cliHandleExcept
(
conn
);
break
;
...
...
@@ -1949,11 +1952,13 @@ static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) {
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
STransConnCtx
*
pCtx
=
pMsg
->
ctx
;
STraceId
*
trace
=
&
pMsg
->
msg
.
info
.
traceId
;
char
tbuf
[
256
]
=
{
0
};
EPSET_DEBUG_STR
(
&
pCtx
->
epSet
,
tbuf
);
tGDebug
(
"%s retry on next node,use:%s, step: %d,timeout:%"
PRId64
""
,
transLabel
(
pThrd
->
pTransInst
),
tbuf
,
pCtx
->
retryStep
,
pCtx
->
retryNextInterval
);
if
(
rpcDebugFlag
&
DEBUG_DEBUG
)
{
STraceId
*
trace
=
&
pMsg
->
msg
.
info
.
traceId
;
char
tbuf
[
256
]
=
{
0
};
EPSET_DEBUG_STR
(
&
pCtx
->
epSet
,
tbuf
);
tGDebug
(
"%s retry on next node,use:%s, step: %d,timeout:%"
PRId64
""
,
transLabel
(
pThrd
->
pTransInst
),
tbuf
,
pCtx
->
retryStep
,
pCtx
->
retryNextInterval
);
}
STaskArg
*
arg
=
taosMemoryMalloc
(
sizeof
(
STaskArg
));
arg
->
param1
=
pMsg
;
...
...
@@ -1990,7 +1995,7 @@ FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) {
pResp
->
pCont
=
buf
;
pResp
->
contLen
=
len
;
*
dst
=
epset
;
epsetAssign
(
dst
,
&
epset
)
;
return
true
;
}
bool
cliResetEpset
(
STransConnCtx
*
pCtx
,
STransMsg
*
pResp
,
bool
hasEpSet
)
{
...
...
@@ -2015,7 +2020,7 @@ bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
}
else
{
if
(
!
transEpSetIsEqual
(
&
pCtx
->
epSet
,
&
epSet
))
{
tDebug
(
"epset not equal, retry new epset"
);
pCtx
->
epSet
=
epSet
;
epsetAssign
(
&
pCtx
->
epSet
,
&
epSet
)
;
noDelay
=
false
;
}
else
{
if
(
pCtx
->
epsetRetryCnt
>=
pCtx
->
epSet
.
numOfEps
)
{
...
...
@@ -2040,7 +2045,7 @@ bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
}
else
{
if
(
!
transEpSetIsEqual
(
&
pCtx
->
epSet
,
&
epSet
))
{
tDebug
(
"epset not equal, retry new epset"
);
pCtx
->
epSet
=
epSet
;
epsetAssign
(
&
pCtx
->
epSet
,
&
epSet
)
;
noDelay
=
false
;
}
else
{
if
(
pCtx
->
epsetRetryCnt
>=
pCtx
->
epSet
.
numOfEps
)
{
...
...
@@ -2130,10 +2135,6 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
if
(
pCtx
->
retryNextInterval
>=
pCtx
->
retryMaxInterval
)
{
pCtx
->
retryNextInterval
=
pCtx
->
retryMaxInterval
;
}
// if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) {
// return false;
// }
}
else
{
pCtx
->
retryNextInterval
=
0
;
pCtx
->
epsetRetryCnt
++
;
...
...
@@ -2181,9 +2182,11 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
STraceId
*
trace
=
&
pResp
->
info
.
traceId
;
bool
hasEpSet
=
cliTryExtractEpSet
(
pResp
,
&
pCtx
->
epSet
);
if
(
hasEpSet
)
{
char
tbuf
[
256
]
=
{
0
};
EPSET_DEBUG_STR
(
&
pCtx
->
epSet
,
tbuf
);
tGTrace
(
"%s conn %p extract epset from msg"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
);
if
(
rpcDebugFlag
&
DEBUG_TRACE
)
{
char
tbuf
[
256
]
=
{
0
};
EPSET_DEBUG_STR
(
&
pCtx
->
epSet
,
tbuf
);
tGTrace
(
"%s conn %p extract epset from msg"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
);
}
}
if
(
pCtx
->
pSem
!=
NULL
)
{
...
...
@@ -2310,8 +2313,9 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
TRACE_SET_MSGID
(
&
pReq
->
info
.
traceId
,
tGenIdPI64
());
STransConnCtx
*
pCtx
=
taosMemoryCalloc
(
1
,
sizeof
(
STransConnCtx
));
pCtx
->
epSet
=
*
pEpSet
;
pCtx
->
origEpSet
=
*
pEpSet
;
epsetAssign
(
&
pCtx
->
epSet
,
pEpSet
);
epsetAssign
(
&
pCtx
->
origEpSet
,
pEpSet
);
pCtx
->
ahandle
=
pReq
->
info
.
ahandle
;
pCtx
->
msgType
=
pReq
->
msgType
;
...
...
@@ -2356,8 +2360,8 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
TRACE_SET_MSGID
(
&
pReq
->
info
.
traceId
,
tGenIdPI64
());
STransConnCtx
*
pCtx
=
taosMemoryCalloc
(
1
,
sizeof
(
STransConnCtx
));
pCtx
->
epSet
=
*
pEpSet
;
pCtx
->
origEpSet
=
*
pEpSet
;
epsetAssign
(
&
pCtx
->
epSet
,
pEpSet
)
;
epsetAssign
(
&
pCtx
->
origEpSet
,
pEpSet
)
;
pCtx
->
ahandle
=
pReq
->
info
.
ahandle
;
pCtx
->
msgType
=
pReq
->
msgType
;
pCtx
->
pSem
=
sem
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录