Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
6ee9d124
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6ee9d124
编写于
10月 27, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1830]
上级
b7362113
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
17 deletion
+29
-17
src/client/src/tscServer.c
src/client/src/tscServer.c
+11
-5
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+16
-12
src/util/src/tutil.c
src/util/src/tutil.c
+1
-0
未找到文件。
src/client/src/tscServer.c
浏览文件 @
6ee9d124
...
...
@@ -150,7 +150,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
pObj
==
NULL
)
return
;
if
(
pObj
!=
pObj
->
signature
)
{
tscError
(
"heart
beat msg, pObj:%p, signature:%p invalid"
,
pObj
,
pObj
->
signature
);
tscError
(
"heartbeat msg, pObj:%p, signature:%p invalid"
,
pObj
,
pObj
->
signature
);
return
;
}
...
...
@@ -175,12 +175,12 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
pRsp
->
streamId
)
tscKillStream
(
pObj
,
htonl
(
pRsp
->
streamId
));
}
}
else
{
tscDebug
(
"
heartbeat failed, code:%s"
,
tstrerror
(
code
));
tscDebug
(
"
%p heartbeat failed, code:%s"
,
pObj
->
pHb
,
tstrerror
(
code
));
}
if
(
pObj
->
pHb
!=
NULL
)
{
int32_t
waitingDuring
=
tsShellActivityTimer
*
500
;
tscDebug
(
"%p s
tart
heartbeat in %dms"
,
pSql
,
waitingDuring
);
tscDebug
(
"%p s
end
heartbeat in %dms"
,
pSql
,
waitingDuring
);
taosTmrReset
(
tscProcessActivityTimer
,
waitingDuring
,
pObj
,
tscTmr
,
&
pObj
->
pTimer
);
}
else
{
...
...
@@ -1639,11 +1639,14 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int
size
=
numOfQueries
*
sizeof
(
SQueryDesc
)
+
numOfStreams
*
sizeof
(
SStreamDesc
)
+
sizeof
(
SCMHeartBeatMsg
)
+
100
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
pthread_mutex_unlock
(
&
pObj
->
mutex
);
tscError
(
"%p failed to
malloc for
heartbeat msg"
,
pSql
);
tscError
(
"%p failed to
create
heartbeat msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
// TODO the expired hb and client can not be identified by server till now.
SCMHeartBeatMsg
*
pHeartbeat
=
(
SCMHeartBeatMsg
*
)
pCmd
->
payload
;
tstrncpy
(
pHeartbeat
->
clientVer
,
version
,
tListLen
(
pHeartbeat
->
clientVer
));
pHeartbeat
->
numOfQueries
=
numOfQueries
;
pHeartbeat
->
numOfStreams
=
numOfStreams
;
...
...
@@ -1996,10 +1999,11 @@ static void createHBObj(STscObj* pObj) {
}
int
tscProcessConnectRsp
(
SSqlObj
*
pSql
)
{
char
temp
[
TSDB_TABLE_FNAME_LEN
*
2
];
STscObj
*
pObj
=
pSql
->
pTscObj
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
char
temp
[
TSDB_TABLE_FNAME_LEN
*
2
]
=
{
0
};
SCMConnectRsp
*
pConnect
=
(
SCMConnectRsp
*
)
pRes
->
pRsp
;
tstrncpy
(
pObj
->
acctId
,
pConnect
->
acctId
,
sizeof
(
pObj
->
acctId
));
// copy acctId from response
int32_t
len
=
sprintf
(
temp
,
"%s%s%s"
,
pObj
->
acctId
,
TS_PATH_DELIMITER
,
pObj
->
db
);
...
...
@@ -2018,6 +2022,8 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
pObj
->
connId
=
htonl
(
pConnect
->
connId
);
createHBObj
(
pObj
);
//launch a timer to send heartbeat to maintain the connection and send status to mnode
taosTmrReset
(
tscProcessActivityTimer
,
tsShellActivityTimer
*
500
,
pObj
,
tscTmr
,
&
pObj
->
pTimer
);
return
0
;
...
...
src/inc/taosmsg.h
浏览文件 @
6ee9d124
...
...
@@ -781,6 +781,7 @@ typedef struct {
}
SStreamDesc
;
typedef
struct
{
char
clientVer
[
TSDB_VERSION_LEN
];
uint32_t
connId
;
int32_t
pid
;
int32_t
numOfQueries
;
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
6ee9d124
...
...
@@ -232,12 +232,16 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
}
static
int32_t
mnodeProcessHeartBeatMsg
(
SMnodeMsg
*
pMsg
)
{
SCMHeartBeatRsp
*
p
HB
Rsp
=
(
SCMHeartBeatRsp
*
)
rpcMallocCont
(
sizeof
(
SCMHeartBeatRsp
));
if
(
p
HB
Rsp
==
NULL
)
{
SCMHeartBeatRsp
*
pRsp
=
(
SCMHeartBeatRsp
*
)
rpcMallocCont
(
sizeof
(
SCMHeartBeatRsp
));
if
(
pRsp
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
SCMHeartBeatMsg
*
pHBMsg
=
pMsg
->
rpcMsg
.
pCont
;
if
(
taosCheckVersion
(
pHBMsg
->
clientVer
,
version
,
3
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_VERSION
;
// todo change the error code
}
SRpcConnInfo
connInfo
=
{
0
};
rpcGetConnInfo
(
pMsg
->
rpcMsg
.
handle
,
&
connInfo
);
...
...
@@ -251,33 +255,33 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) {
if
(
pConn
==
NULL
)
{
// do not close existing links, otherwise
// mError("failed to create connId, close connect");
// p
HB
Rsp->killConnection = 1;
// pRsp->killConnection = 1;
}
else
{
p
HB
Rsp
->
connId
=
htonl
(
pConn
->
connId
);
pRsp
->
connId
=
htonl
(
pConn
->
connId
);
mnodeSaveQueryStreamList
(
pConn
,
pHBMsg
);
if
(
pConn
->
killed
!=
0
)
{
p
HB
Rsp
->
killConnection
=
1
;
pRsp
->
killConnection
=
1
;
}
if
(
pConn
->
streamId
!=
0
)
{
p
HB
Rsp
->
streamId
=
htonl
(
pConn
->
streamId
);
pRsp
->
streamId
=
htonl
(
pConn
->
streamId
);
pConn
->
streamId
=
0
;
}
if
(
pConn
->
queryId
!=
0
)
{
p
HB
Rsp
->
queryId
=
htonl
(
pConn
->
queryId
);
pRsp
->
queryId
=
htonl
(
pConn
->
queryId
);
pConn
->
queryId
=
0
;
}
}
p
HB
Rsp
->
onlineDnodes
=
htonl
(
mnodeGetOnlineDnodesNum
());
p
HB
Rsp
->
totalDnodes
=
htonl
(
mnodeGetDnodesNum
());
mnodeGetMnodeEpSetForShell
(
&
p
HB
Rsp
->
epSet
);
pRsp
->
onlineDnodes
=
htonl
(
mnodeGetOnlineDnodesNum
());
pRsp
->
totalDnodes
=
htonl
(
mnodeGetDnodesNum
());
mnodeGetMnodeEpSetForShell
(
&
pRsp
->
epSet
);
pMsg
->
rpcRsp
.
rsp
=
p
HB
Rsp
;
pMsg
->
rpcRsp
.
rsp
=
pRsp
;
pMsg
->
rpcRsp
.
len
=
sizeof
(
SCMHeartBeatRsp
);
mnodeReleaseConn
(
pConn
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/util/src/tutil.c
浏览文件 @
6ee9d124
...
...
@@ -326,6 +326,7 @@ int32_t taosHexStrToByteArray(char hexstr[], char bytes[]) {
return
0
;
}
// TODO move to comm module
bool
taosGetVersionNumber
(
char
*
versionStr
,
int
*
versionNubmer
)
{
if
(
versionStr
==
NULL
||
versionNubmer
==
NULL
)
{
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录