Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9f20bf05
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
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看板
提交
9f20bf05
编写于
7月 29, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(rpc): probe add complete log
上级
19bf81a4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
32 deletion
+44
-32
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+0
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+27
-18
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+3
-1
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+14
-12
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
9f20bf05
...
@@ -401,7 +401,6 @@ typedef struct SSqlObj {
...
@@ -401,7 +401,6 @@ typedef struct SSqlObj {
// connect alive
// connect alive
int64_t
lastProbe
;
int64_t
lastProbe
;
int64_t
lastAlive
;
int64_t
lastAlive
;
char
noAckCnt
;
// no recevie ack from sever count
void
*
pPrevContext
;
void
*
pPrevContext
;
void
*
pPrevConn
;
void
*
pPrevConn
;
void
*
pPrevFdObj
;
void
*
pPrevFdObj
;
...
...
src/client/src/tscServer.c
浏览文件 @
9f20bf05
...
@@ -284,10 +284,9 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
...
@@ -284,10 +284,9 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
// pSql connection link is broken
// pSql connection link is broken
bool
dealConnBroken
(
SSqlObj
*
pSql
)
{
bool
dealConnBroken
(
SSqlObj
*
pSql
)
{
// check valid
// check valid
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
return
false
;
if
(
pSql
->
signature
!=
pSql
)
{
}
tscInfo
(
"PROBE 0x%"
PRIx64
" break link signature is not equal pSql. signature=%p"
,
pSql
->
self
,
pSql
->
signature
);
if
(
pSql
->
cmd
.
command
>=
TSDB_SQL_LOCAL
)
{
return
false
;
return
false
;
}
}
...
@@ -296,13 +295,15 @@ bool dealConnBroken(SSqlObj * pSql) {
...
@@ -296,13 +295,15 @@ bool dealConnBroken(SSqlObj * pSql) {
// cancel
// cancel
if
(
pSql
->
rpcRid
>
0
)
{
if
(
pSql
->
rpcRid
>
0
)
{
tsc
Debug
(
"PROBE 0x%"
PRIx64
" rpc cancel request rpcRid=0x%"
PRIx64
"."
,
pSql
->
self
,
pSql
->
rpcRid
);
tsc
Info
(
"PROBE 0x%"
PRIx64
" break link done. rpcRid=0x%"
PRIx64
,
pSql
->
self
,
pSql
->
rpcRid
);
rpcCancelRequest
(
pSql
->
rpcRid
);
rpcCancelRequest
(
pSql
->
rpcRid
);
pSql
->
rpcRid
=
-
1
;
pSql
->
rpcRid
=
-
1
;
}
else
{
tscInfo
(
"PROBE 0x%"
PRIx64
" break link rpcRid <=0. rpcRid=0x%"
PRIx64
,
pSql
->
self
,
pSql
->
rpcRid
);
}
}
// error
// error
notify
tsc
Debug
(
"PROBE 0x%"
PRIx64
" async result error."
,
pSql
->
self
);
tsc
Info
(
"PROBE 0x%"
PRIx64
" async result error. rpcRid=0x%"
PRIx64
,
pSql
->
self
,
pSql
->
rpcRid
);
tscAsyncResultOnError
(
pSql
);
tscAsyncResultOnError
(
pSql
);
return
true
;
return
true
;
...
@@ -316,6 +317,7 @@ bool sendProbeConnMsg(SSqlObj* pSql) {
...
@@ -316,6 +317,7 @@ bool sendProbeConnMsg(SSqlObj* pSql) {
if
(
pSql
->
stime
==
0
)
{
if
(
pSql
->
stime
==
0
)
{
// not start , no need probe
// not start , no need probe
tscInfo
(
"PROBE 0x%"
PRIx64
" not start, no need probe."
,
pSql
->
self
);
return
true
;
return
true
;
}
}
...
@@ -323,39 +325,47 @@ bool sendProbeConnMsg(SSqlObj* pSql) {
...
@@ -323,39 +325,47 @@ bool sendProbeConnMsg(SSqlObj* pSql) {
int32_t
diff
=
(
int32_t
)(
taosGetTimestampMs
()
-
stime
);
int32_t
diff
=
(
int32_t
)(
taosGetTimestampMs
()
-
stime
);
if
(
diff
<
tsProbeSeconds
*
1000
)
{
if
(
diff
<
tsProbeSeconds
*
1000
)
{
// exec time short , need not probe alive
// exec time short , need not probe alive
tscInfo
(
"PROBE 0x%"
PRIx64
"not arrived probe time. timeout=%ds, no need probe. lastAlive=%"
PRId64
" stime=%"
PRId64
,
\
pSql
->
self
,
tsProbeSeconds
,
pSql
->
lastAlive
,
pSql
->
stime
);
return
true
;
return
true
;
}
}
if
(
diff
>
tsProbeKillSeconds
*
1000
)
{
if
(
diff
>
tsProbeKillSeconds
*
1000
)
{
// need kill query
// need kill query
tscDebug
(
"PROBE 0x%"
PRIx64
" need killed, noAckCnt:%d diff=%d"
,
pSql
->
self
,
pSql
->
noAckCnt
,
diff
);
tscInfo
(
"PROBE 0x%"
PRIx64
"kill query by probe. because arrived kill time. timeout=%ds lastAlive=%"
PRId64
" stime=%"
PRId64
,
\
pSql
->
self
,
tsProbeKillSeconds
,
pSql
->
lastAlive
,
pSql
->
stime
);
return
false
;
return
false
;
}
}
if
(
pSql
->
pPrevContext
==
NULL
||
pSql
->
pPrevConn
==
NULL
||
pSql
->
pPrevFdObj
==
NULL
||
pSql
->
prevFd
<=
0
)
{
if
(
pSql
->
pPrevContext
==
NULL
||
pSql
->
pPrevConn
==
NULL
||
pSql
->
pPrevFdObj
==
NULL
||
pSql
->
prevFd
<=
0
)
{
// last connect info save uncompletely, so can't probe
// last connect info save uncompletely, so can't probe
tscInfo
(
"PROBE 0x%"
PRIx64
"save last connect info uncompletely. prev context=%p conn=%p fdobj=%p fd=%d"
,
\
pSql
->
self
,
pSql
->
pPrevContext
,
pSql
->
pPrevConn
,
pSql
->
pPrevFdObj
,
pSql
->
prevFd
);
return
true
;
return
true
;
}
}
if
(
pSql
->
rpcRid
==
-
1
)
{
if
(
pSql
->
rpcRid
==
-
1
)
{
// cancel or reponse ok from server, so need not probe
// cancel or reponse ok from server, so need not probe
tscInfo
(
"PROBE 0x%"
PRIx64
" rpcRid is -1, response ok. no need probe."
,
pSql
->
self
);
return
true
;
return
true
;
}
}
// It's long time from lastAlive, so need probe
// It's long time from lastAlive, so need probe
pSql
->
noAckCnt
++
;
pSql
->
lastProbe
=
taosGetTimestampMs
();
pSql
->
lastProbe
=
taosGetTimestampMs
();
tscDebug
(
"0x%"
PRIx64
" sendProbeConnMsg noAckCnt:%d diff=%d"
,
pSql
->
self
,
pSql
->
noAckCnt
,
diff
);
bool
ret
=
rpcSendProbe
(
pSql
->
rpcRid
,
pSql
->
pPrevContext
,
pSql
->
pPrevConn
,
pSql
->
pPrevFdObj
,
pSql
->
prevFd
);
return
rpcSendProbe
(
pSql
->
rpcRid
,
pSql
->
pPrevContext
,
pSql
->
pPrevConn
,
pSql
->
pPrevFdObj
,
pSql
->
prevFd
);
tscInfo
(
"PROBE 0x%"
PRIx64
" rpcRid=0x%"
PRIx64
" send probe msg, ret=%d"
,
pSql
->
self
,
pSql
->
rpcRid
,
ret
);
return
ret
;
}
}
// check have broken link queries than killed
// check have broken link queries than killed
void
checkBrokenQueries
(
STscObj
*
pTscObj
)
{
void
checkBrokenQueries
(
STscObj
*
pTscObj
)
{
//
tscDebug
(
"PROBE checkBrokenQueries pTscObj=%p pTscObj->rid=0x%"
PRIx64
,
pTscObj
,
pTscObj
->
rid
);
SSqlObj
*
pSql
=
pTscObj
->
sqlList
;
SSqlObj
*
pSql
=
pTscObj
->
sqlList
;
while
(
pSql
)
{
while
(
pSql
)
{
int32_t
numOfSub
=
pSql
->
subState
.
numOfSub
;
int32_t
numOfSub
=
pSql
->
subState
.
numOfSub
;
tscInfo
(
"PROBE 0x%"
PRIx64
" numOfSub=%d sql=%s"
,
pSql
->
self
,
numOfSub
,
pSql
->
sqlstr
==
NULL
?
""
:
pSql
->
sqlstr
);
if
(
numOfSub
==
0
)
{
if
(
numOfSub
==
0
)
{
// no sub sql
// no sub sql
if
(
!
sendProbeConnMsg
(
pSql
))
{
if
(
!
sendProbeConnMsg
(
pSql
))
{
...
@@ -396,9 +406,9 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
...
@@ -396,9 +406,9 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
assert
(
pHB
->
self
==
pObj
->
hbrid
);
assert
(
pHB
->
self
==
pObj
->
hbrid
);
// check queries already death
// check queries already death
static
int
activety
Timer
Cnt
=
0
;
static
int
activetyCnt
=
0
;
if
(
++
activety
Timer
Cnt
>
3
)
{
// 1.5s * 10 = 15s interval call
if
(
++
activetyCnt
>
3
)
{
// 1.5s * 10 = 15s interval call
activety
Timer
Cnt
=
0
;
activetyCnt
=
0
;
// call check if have query doing
// call check if have query doing
if
(
pObj
->
sqlList
)
{
if
(
pObj
->
sqlList
)
{
...
@@ -532,9 +542,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -532,9 +542,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
// check msgtype
// check msgtype
if
(
rpcMsg
->
msgType
==
TSDB_MSG_TYPE_PROBE_CONN_RSP
)
{
if
(
rpcMsg
->
msgType
==
TSDB_MSG_TYPE_PROBE_CONN_RSP
)
{
pSql
->
noAckCnt
=
0
;
pSql
->
lastAlive
=
taosGetTimestampMs
();
pSql
->
lastAlive
=
taosGetTimestampMs
();
tscDebug
(
"PROBE 0x%"
PRIx64
" recv probe
msg. sql=%s"
,
pSql
->
self
,
pSql
->
sqlstr
);
tscDebug
(
"PROBE 0x%"
PRIx64
" recv probe
response msg. rpcRid=0x%"
PRIx64
,
pSql
->
self
,
pSql
->
rpcRid
);
rpcFreeCont
(
rpcMsg
->
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
return
;
}
}
...
...
src/query/src/qExecutor.c
浏览文件 @
9f20bf05
...
@@ -6368,7 +6368,9 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
...
@@ -6368,7 +6368,9 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
publishOperatorProfEvent
(
pOperator
->
upstream
[
0
],
QUERY_PROF_AFTER_OPERATOR_EXEC
);
publishOperatorProfEvent
(
pOperator
->
upstream
[
0
],
QUERY_PROF_AFTER_OPERATOR_EXEC
);
// TEST TODU DELETE
// TEST TODU DELETE
taosMsleep
(
10
*
1000
);
static
int
loop
=
0
;
taosMsleep
(
3
*
1000
);
qInfo
(
" loop=%d pEnv=%p"
,
loop
++
,
pRuntimeEnv
);
if
(
pBlock
==
NULL
)
{
if
(
pBlock
==
NULL
)
{
...
...
src/rpc/src/rpcMain.c
浏览文件 @
9f20bf05
...
@@ -1101,7 +1101,7 @@ static void rpcProcessProbeMsg(SRecvInfo *pRecv, SRpcConn *pConn) {
...
@@ -1101,7 +1101,7 @@ static void rpcProcessProbeMsg(SRecvInfo *pRecv, SRpcConn *pConn) {
memcpy
(
rspHead
.
user
,
pHead
->
user
,
tListLen
(
pHead
->
user
));
memcpy
(
rspHead
.
user
,
pHead
->
user
,
tListLen
(
pHead
->
user
));
bool
ret
=
rpcSendMsgToPeer
(
pConn
,
&
rspHead
,
sizeof
(
SRpcHead
));
bool
ret
=
rpcSendMsgToPeer
(
pConn
,
&
rspHead
,
sizeof
(
SRpcHead
));
t
Debug
(
"PROBE 0x%"
PRIx64
" recv probe msg and
response. ret=%d"
,
pHead
->
ahandle
,
ret
);
t
Info
(
"PROBE 0x%"
PRIx64
" recv probe msg and do
response. ret=%d"
,
pHead
->
ahandle
,
ret
);
rpcFreeMsg
(
pRecv
->
msg
);
rpcFreeMsg
(
pRecv
->
msg
);
rpcUnlockConn
(
pConn
);
rpcUnlockConn
(
pConn
);
}
else
if
(
pHead
->
msgType
==
TSDB_MSG_TYPE_PROBE_CONN_RSP
)
{
}
else
if
(
pHead
->
msgType
==
TSDB_MSG_TYPE_PROBE_CONN_RSP
)
{
...
@@ -1115,12 +1115,14 @@ static void rpcProcessProbeMsg(SRecvInfo *pRecv, SRpcConn *pConn) {
...
@@ -1115,12 +1115,14 @@ static void rpcProcessProbeMsg(SRecvInfo *pRecv, SRpcConn *pConn) {
rpcProcessIncomingMsg
(
pConn
,
pHead
,
pContext
);
rpcProcessIncomingMsg
(
pConn
,
pHead
,
pContext
);
taosReleaseRef
(
tsRpcRefId
,
pConn
->
rid
);
taosReleaseRef
(
tsRpcRefId
,
pConn
->
rid
);
}
else
{
}
else
{
t
Error
(
"PROBE recv probe msg get context is NULL. rid=%"
PRId64
" NULL."
,
pConn
->
rid
);
t
Info
(
"PROBE 0x%"
PRIx64
" get reqContext by rid return NULL. pConn->rid=0x%"
PRIX64
,
pHead
->
ahandle
,
pConn
->
rid
);
}
}
rpcUnlockConn
(
pConn
);
rpcUnlockConn
(
pConn
);
tInfo
(
"PROBE 0x%"
PRIx64
" recv response probe msg and update lastLiveTime. pConn=%p"
,
pHead
->
ahandle
,
pConn
);
}
else
{
tInfo
(
"PROBE 0x%"
PRIx64
" recv response probe msg but pConn is NULL."
,
pHead
->
ahandle
);
}
}
tDebug
(
"PROBE 0x%"
PRIx64
" recv response probe msg and update lastLiveTime. pConn=%p"
,
pHead
->
ahandle
,
pConn
);
}
}
}
}
...
@@ -1789,46 +1791,46 @@ bool rpcSendProbe(int64_t rpcRid, void* pPrevContext, void* pPrevConn, void* pPr
...
@@ -1789,46 +1791,46 @@ bool rpcSendProbe(int64_t rpcRid, void* pPrevContext, void* pPrevConn, void* pPr
// return false can kill query
// return false can kill query
bool
ret
=
false
;
bool
ret
=
false
;
if
(
rpcRid
<
0
)
{
if
(
rpcRid
<
0
)
{
tError
(
"PROBE rpcRid=
%"
PRId
64
" less than zero, invalid."
,
rpcRid
);
tError
(
"PROBE rpcRid=
0x%"
PRIx
64
" less than zero, invalid."
,
rpcRid
);
return
false
;
return
false
;
}
}
// get req content
// get req content
SRpcReqContext
*
pContext
=
taosAcquireRef
(
tsRpcRefId
,
rpcRid
);
SRpcReqContext
*
pContext
=
taosAcquireRef
(
tsRpcRefId
,
rpcRid
);
if
(
pContext
==
NULL
)
{
if
(
pContext
==
NULL
)
{
tError
(
"PROBE rpcRid=
%"
PRId
64
" get context NULL. sql finished no need send probe."
,
rpcRid
);
tError
(
"PROBE rpcRid=
0x%"
PRIx
64
" get context NULL. sql finished no need send probe."
,
rpcRid
);
return
true
;
return
true
;
}
}
// context same
// context same
if
(
pContext
!=
pPrevContext
)
{
if
(
pContext
!=
pPrevContext
)
{
tError
(
"PROBE rpcRid=
%"
PRId
64
" context diff. pContext=%p pPreContent=%p"
,
rpcRid
,
pContext
,
pPrevContext
);
tError
(
"PROBE rpcRid=
0x%"
PRIx
64
" context diff. pContext=%p pPreContent=%p"
,
rpcRid
,
pContext
,
pPrevContext
);
goto
_END
;
goto
_END
;
}
}
// conn same
// conn same
if
(
pContext
->
pConn
!=
pPrevConn
)
{
if
(
pContext
->
pConn
!=
pPrevConn
)
{
tError
(
"PROBE rpcRid=
%"
PRId
64
" connect obj diff. pContext->pConn=%p pPreConn=%p"
,
rpcRid
,
pContext
->
pConn
,
pPrevConn
);
tError
(
"PROBE rpcRid=
0x%"
PRIx
64
" connect obj diff. pContext->pConn=%p pPreConn=%p"
,
rpcRid
,
pContext
->
pConn
,
pPrevConn
);
ret
=
pContext
->
pConn
==
NULL
;
ret
=
pContext
->
pConn
==
NULL
;
goto
_END
;
goto
_END
;
}
}
// fdObj same
// fdObj same
if
(
pContext
->
pConn
->
chandle
!=
pPrevFdObj
)
{
if
(
pContext
->
pConn
->
chandle
!=
pPrevFdObj
)
{
tError
(
"PROBE rpcRid=
%"
PRId
64
" connect fdObj diff. pContext->pConn->chandle=%p pPrevFdObj=%p"
,
rpcRid
,
pContext
->
pConn
->
chandle
,
pPrevFdObj
);
tError
(
"PROBE rpcRid=
0x%"
PRIx
64
" connect fdObj diff. pContext->pConn->chandle=%p pPrevFdObj=%p"
,
rpcRid
,
pContext
->
pConn
->
chandle
,
pPrevFdObj
);
goto
_END
;
goto
_END
;
}
}
// fd same
// fd same
int32_t
fd
=
taosGetFdID
(
pContext
->
pConn
->
chandle
);
int32_t
fd
=
taosGetFdID
(
pContext
->
pConn
->
chandle
);
if
(
fd
!=
prevFd
)
{
if
(
fd
!=
prevFd
)
{
tError
(
"PROBE rpcRid=
%"
PRId
64
" connect fd diff.fd=%d prevFd=%d"
,
rpcRid
,
fd
,
prevFd
);
tError
(
"PROBE rpcRid=
0x%"
PRIx
64
" connect fd diff.fd=%d prevFd=%d"
,
rpcRid
,
fd
,
prevFd
);
goto
_END
;
goto
_END
;
}
}
// send syn
// send syn
ret
=
doRpcSendProbe
(
pContext
->
pConn
);
ret
=
doRpcSendProbe
(
pContext
->
pConn
);
tInfo
(
"PROBE 0x%"
PRIx64
" r
pcRid=%"
PRId
64
" send data ret=%d fd=%d."
,
(
int64_t
)
pContext
->
ahandle
,
rpcRid
,
ret
,
fd
);
tInfo
(
"PROBE 0x%"
PRIx64
" r
rpcRid=0x%"
PRIx
64
" send data ret=%d fd=%d."
,
(
int64_t
)
pContext
->
ahandle
,
rpcRid
,
ret
,
fd
);
_END:
_END:
// put back req context
// put back req context
...
@@ -1839,13 +1841,13 @@ _END:
...
@@ -1839,13 +1841,13 @@ _END:
// after sql request send , save conn info
// after sql request send , save conn info
bool
rpcSaveSendInfo
(
int64_t
rpcRid
,
void
**
ppContext
,
void
**
ppConn
,
void
**
ppFdObj
,
int32_t
*
pFd
)
{
bool
rpcSaveSendInfo
(
int64_t
rpcRid
,
void
**
ppContext
,
void
**
ppConn
,
void
**
ppFdObj
,
int32_t
*
pFd
)
{
if
(
rpcRid
<
0
)
{
if
(
rpcRid
<
0
)
{
tError
(
"PROBE saveSendInfo rpcRid=
%"
PRId
64
" less than zero, invalid."
,
rpcRid
);
tError
(
"PROBE saveSendInfo rpcRid=
0x%"
PRIx
64
" less than zero, invalid."
,
rpcRid
);
return
false
;
return
false
;
}
}
// get req content
// get req content
SRpcReqContext
*
pContext
=
taosAcquireRef
(
tsRpcRefId
,
rpcRid
);
SRpcReqContext
*
pContext
=
taosAcquireRef
(
tsRpcRefId
,
rpcRid
);
if
(
pContext
==
NULL
)
{
if
(
pContext
==
NULL
)
{
tError
(
"PROBE
rpcRid=%"
PRId
64
" get context NULL."
,
rpcRid
);
tError
(
"PROBE
saveSendInfo rpcRid=0x%"
PRIx
64
" get context NULL."
,
rpcRid
);
return
false
;
return
false
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录