Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9e8c63af
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看板
未验证
提交
9e8c63af
编写于
6月 15, 2022
作者:
dengyihao
提交者:
GitHub
6月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13838 from taosdata/enh/log
Enh/log
上级
63a9aee5
f6287282
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
19 deletion
+22
-19
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+12
-11
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+8
-8
source/util/src/terror.c
source/util/src/terror.c
+1
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
9e8c63af
...
...
@@ -702,6 +702,7 @@ int32_t* taosGetErrno();
//index
#define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200)
#ifdef __cplusplus
}
#endif
...
...
source/libs/transport/src/transCli.c
浏览文件 @
9e8c63af
...
...
@@ -41,7 +41,7 @@ typedef struct SCliConn {
// debug and log info
struct
sockaddr_in
addr
;
struct
sockaddr_in
locaddr
;
struct
sockaddr_in
loca
lA
ddr
;
}
SCliConn
;
typedef
struct
SCliMsg
{
...
...
@@ -54,7 +54,8 @@ typedef struct SCliMsg {
}
SCliMsg
;
typedef
struct
SCliThrdObj
{
TdThread
thread
;
TdThread
thread
;
// tid
int64_t
pid
;
// pid
uv_loop_t
*
loop
;
SAsyncPool
*
asyncPool
;
uv_timer_t
timer
;
...
...
@@ -325,7 +326,7 @@ void cliHandleResp(SCliConn* conn) {
tDebug
(
"%s cli conn %p %s received from %s:%d, local info: %s:%d, msg size: %d"
,
pTransInst
->
label
,
conn
,
TMSG_INFO
(
pHead
->
msgType
),
taosInetNtoa
(
conn
->
addr
.
sin_addr
),
ntohs
(
conn
->
addr
.
sin_port
),
taosInetNtoa
(
conn
->
loca
ddr
.
sin_addr
),
ntohs
(
conn
->
loca
ddr
.
sin_port
),
transMsg
.
contLen
);
taosInetNtoa
(
conn
->
loca
lAddr
.
sin_addr
),
ntohs
(
conn
->
localA
ddr
.
sin_port
),
transMsg
.
contLen
);
if
(
pCtx
==
NULL
&&
CONN_NO_PERSIST_BY_APP
(
conn
))
{
tTrace
(
"except, server continue send while cli ignore it"
);
...
...
@@ -643,7 +644,7 @@ void cliSend(SCliConn* pConn) {
uv_buf_t
wb
=
uv_buf_init
((
char
*
)
pHead
,
msgLen
);
tDebug
(
"%s cli conn %p %s is send to %s:%d, local info %s:%d"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
,
TMSG_INFO
(
pHead
->
msgType
),
taosInetNtoa
(
pConn
->
addr
.
sin_addr
),
ntohs
(
pConn
->
addr
.
sin_port
),
taosInetNtoa
(
pConn
->
loca
ddr
.
sin_addr
),
ntohs
(
pConn
->
loca
ddr
.
sin_port
));
taosInetNtoa
(
pConn
->
loca
lAddr
.
sin_addr
),
ntohs
(
pConn
->
localA
ddr
.
sin_port
));
if
(
pHead
->
persist
==
1
)
{
CONN_SET_PERSIST_BY_APP
(
pConn
);
...
...
@@ -668,8 +669,8 @@ void cliConnCb(uv_connect_t* req, int status) {
int
addrlen
=
sizeof
(
pConn
->
addr
);
uv_tcp_getpeername
((
uv_tcp_t
*
)
pConn
->
stream
,
(
struct
sockaddr
*
)
&
pConn
->
addr
,
&
addrlen
);
addrlen
=
sizeof
(
pConn
->
locaddr
);
uv_tcp_getsockname
((
uv_tcp_t
*
)
pConn
->
stream
,
(
struct
sockaddr
*
)
&
pConn
->
locaddr
,
&
addrlen
);
addrlen
=
sizeof
(
pConn
->
loca
lA
ddr
);
uv_tcp_getsockname
((
uv_tcp_t
*
)
pConn
->
stream
,
(
struct
sockaddr
*
)
&
pConn
->
loca
lA
ddr
,
&
addrlen
);
tTrace
(
"%s cli conn %p connect to server successfully"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
);
assert
(
pConn
->
stream
==
req
->
handle
);
...
...
@@ -742,8 +743,7 @@ void cliMayCvtFqdnToIp(SEpSet* pEpSet, SCvtAddr* pCvtAddr) {
void
cliHandleReq
(
SCliMsg
*
pMsg
,
SCliThrdObj
*
pThrd
)
{
uint64_t
et
=
taosGetTimestampUs
();
uint64_t
el
=
et
-
pMsg
->
st
;
tTrace
(
"%s cli msg tran time cost: %"
PRIu64
"us, threadID: %"
PRId64
""
,
((
STrans
*
)
pThrd
->
pTransInst
)
->
label
,
el
,
pThrd
->
thread
);
// tTrace("%s cli msg tran time cost: %" PRIu64 "us", ((STrans*)pThrd->pTransInst)->label, el);
STransConnCtx
*
pCtx
=
pMsg
->
ctx
;
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
...
...
@@ -822,6 +822,7 @@ static void cliAsyncCb(uv_async_t* handle) {
static
void
*
cliWorkThread
(
void
*
arg
)
{
SCliThrdObj
*
pThrd
=
(
SCliThrdObj
*
)
arg
;
pThrd
->
pid
=
taosGetSelfPthreadId
();
setThreadName
(
"trans-cli-work"
);
uv_run
(
pThrd
->
loop
,
UV_RUN_DEFAULT
);
return
NULL
;
...
...
@@ -1089,7 +1090,7 @@ void transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra
SCliThrdObj
*
thrd
=
((
SCliObj
*
)
pTransInst
->
tcphandle
)
->
pThreadObj
[
index
];
tDebug
(
"send request at thread:%d, threadID: %
"
PRId64
", msg: %p, dst: %s:%d, app:%p"
,
index
,
thrd
->
threa
d
,
pReq
,
tDebug
(
"send request at thread:%d, threadID: %
08"
PRId64
", msg: %p, dst: %s:%d, app:%p"
,
index
,
thrd
->
pi
d
,
pReq
,
EPSET_GET_INUSE_IP
(
&
pCtx
->
epSet
),
EPSET_GET_INUSE_PORT
(
&
pCtx
->
epSet
),
pReq
->
info
.
ahandle
);
ASSERT
(
transSendAsync
(
thrd
->
asyncPool
,
&
(
cliMsg
->
q
))
==
0
);
}
...
...
@@ -1118,7 +1119,7 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM
cliMsg
->
type
=
Normal
;
SCliThrdObj
*
thrd
=
((
SCliObj
*
)
pTransInst
->
tcphandle
)
->
pThreadObj
[
index
];
tDebug
(
"send request at thread:%d, threadID:%
"
PRId64
", msg: %p, dst: %s:%d, app:%p"
,
index
,
thrd
->
threa
d
,
pReq
,
tDebug
(
"send request at thread:%d, threadID:%
08"
PRId64
", msg: %p, dst: %s:%d, app:%p"
,
index
,
thrd
->
pi
d
,
pReq
,
EPSET_GET_INUSE_IP
(
&
pCtx
->
epSet
),
EPSET_GET_INUSE_PORT
(
&
pCtx
->
epSet
),
pReq
->
info
.
ahandle
);
transSendAsync
(
thrd
->
asyncPool
,
&
(
cliMsg
->
q
));
...
...
@@ -1149,7 +1150,7 @@ void transSetDefaultAddr(void* ahandle, const char* ip, const char* fqdn) {
cliMsg
->
type
=
Update
;
SCliThrdObj
*
thrd
=
((
SCliObj
*
)
pTransInst
->
tcphandle
)
->
pThreadObj
[
i
];
tDebug
(
"update epset at thread:%d, threadID:%
"
PRId64
""
,
i
,
thrd
->
threa
d
);
tDebug
(
"update epset at thread:%d, threadID:%
08"
PRId64
""
,
i
,
thrd
->
pi
d
);
transSendAsync
(
thrd
->
asyncPool
,
&
(
cliMsg
->
q
));
}
...
...
source/libs/transport/src/transSvr.c
浏览文件 @
9e8c63af
...
...
@@ -48,7 +48,7 @@ typedef struct SSvrConn {
ConnStatus
status
;
struct
sockaddr_in
addr
;
struct
sockaddr_in
locaddr
;
struct
sockaddr_in
loca
lA
ddr
;
int64_t
refId
;
int
spi
;
...
...
@@ -286,12 +286,12 @@ static void uvHandleReq(SSvrConn* pConn) {
if
(
pConn
->
status
==
ConnNormal
&&
pHead
->
noResp
==
0
)
{
transRefSrvHandle
(
pConn
);
tDebug
(
"server conn %p %s received from %s:%d, local info: %s:%d, msg size: %d"
,
pConn
,
TMSG_INFO
(
transMsg
.
msgType
),
taosInetNtoa
(
pConn
->
addr
.
sin_addr
),
ntohs
(
pConn
->
addr
.
sin_port
),
taosInetNtoa
(
pConn
->
locaddr
.
sin_addr
),
ntohs
(
pConn
->
locaddr
.
sin_port
),
transMsg
.
contLen
);
taosInetNtoa
(
pConn
->
addr
.
sin_addr
),
ntohs
(
pConn
->
addr
.
sin_port
),
taosInetNtoa
(
pConn
->
loca
lA
ddr
.
sin_addr
),
ntohs
(
pConn
->
loca
lA
ddr
.
sin_port
),
transMsg
.
contLen
);
}
else
{
tDebug
(
"server conn %p %s received from %s:%d, local info: %s:%d, msg size: %d, resp:%d "
,
pConn
,
TMSG_INFO
(
transMsg
.
msgType
),
taosInetNtoa
(
pConn
->
addr
.
sin_addr
),
ntohs
(
pConn
->
addr
.
sin_port
),
taosInetNtoa
(
pConn
->
loca
ddr
.
sin_addr
),
ntohs
(
pConn
->
loca
ddr
.
sin_port
),
transMsg
.
contLen
,
pHead
->
noResp
);
taosInetNtoa
(
pConn
->
loca
lAddr
.
sin_addr
),
ntohs
(
pConn
->
localA
ddr
.
sin_port
),
transMsg
.
contLen
,
pHead
->
noResp
);
// no ref here
}
...
...
@@ -454,8 +454,8 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
char
*
msg
=
(
char
*
)
pHead
;
int32_t
len
=
transMsgLenFromCont
(
pMsg
->
contLen
);
tDebug
(
"server conn %p %s is sent to %s:%d, local info: %s:%d, msglen:%d"
,
pConn
,
TMSG_INFO
(
pHead
->
msgType
),
taosInetNtoa
(
pConn
->
addr
.
sin_addr
),
ntohs
(
pConn
->
addr
.
sin_port
),
taosInetNtoa
(
pConn
->
locaddr
.
sin_addr
),
ntohs
(
pConn
->
locaddr
.
sin_port
),
len
);
taosInetNtoa
(
pConn
->
addr
.
sin_addr
),
ntohs
(
pConn
->
addr
.
sin_port
),
taosInetNtoa
(
pConn
->
loca
lA
ddr
.
sin_addr
),
ntohs
(
pConn
->
loca
lA
ddr
.
sin_port
),
len
);
pHead
->
msgLen
=
htonl
(
len
);
wb
->
base
=
msg
;
...
...
@@ -686,8 +686,8 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
return
;
}
addrlen
=
sizeof
(
pConn
->
locaddr
);
if
(
0
!=
uv_tcp_getsockname
(
pConn
->
pTcp
,
(
struct
sockaddr
*
)
&
pConn
->
locaddr
,
&
addrlen
))
{
addrlen
=
sizeof
(
pConn
->
loca
lA
ddr
);
if
(
0
!=
uv_tcp_getsockname
(
pConn
->
pTcp
,
(
struct
sockaddr
*
)
&
pConn
->
loca
lA
ddr
,
&
addrlen
))
{
tError
(
"server conn %p failed to get local info"
,
pConn
);
transUnrefSrvHandle
(
pConn
);
return
;
...
...
source/util/src/terror.c
浏览文件 @
9e8c63af
...
...
@@ -568,6 +568,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_NO_INDEX_IN_CACHE, "No tsma index in ca
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_INVALID_ENV
,
"Invalid rsma env"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_INVALID_STAT
,
"Invalid rsma state"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INDEX_REBUILDING
,
"Index is rebuilding"
)
#ifdef TAOS_ERROR_C
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录