Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
21a5e4f9
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看板
提交
21a5e4f9
编写于
4月 14, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix hb issue
上级
c04bc182
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
29 addition
and
37 deletion
+29
-37
include/common/tmsg.h
include/common/tmsg.h
+8
-10
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+3
-8
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-1
source/client/src/clientHb.c
source/client/src/clientHb.c
+12
-12
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-2
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+3
-3
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+1
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
21a5e4f9
...
...
@@ -70,13 +70,11 @@ typedef uint16_t tmsg_t;
#define TSDB_IE_TYPE_DNODE_EXT 6
#define TSDB_IE_TYPE_DNODE_STATE 7
typedef
enum
{
HEARTBEAT_TYPE_MQ
=
0
,
HEARTBEAT_TYPE_QUERY
,
// types can be added here
//
HEARTBEAT_TYPE_MAX
}
EHbType
;
enum
{
CONN_TYPE__QUERY
=
1
,
CONN_TYPE__TMQ
,
CONN_TYPE__MAX
};
enum
{
HEARTBEAT_KEY_DBINFO
=
1
,
...
...
@@ -1649,7 +1647,7 @@ typedef struct {
typedef
struct
{
int64_t
tscRid
;
int
32_t
hb
Type
;
int
8_t
conn
Type
;
}
SClientHbKey
;
typedef
struct
{
...
...
@@ -1796,13 +1794,13 @@ static FORCE_INLINE int32_t tDecodeSKv(SCoder* pDecoder, SKv* pKv) {
static
FORCE_INLINE
int32_t
tEncodeSClientHbKey
(
SCoder
*
pEncoder
,
const
SClientHbKey
*
pKey
)
{
if
(
tEncodeI64
(
pEncoder
,
pKey
->
tscRid
)
<
0
)
return
-
1
;
if
(
tEncodeI
32
(
pEncoder
,
pKey
->
hb
Type
)
<
0
)
return
-
1
;
if
(
tEncodeI
8
(
pEncoder
,
pKey
->
conn
Type
)
<
0
)
return
-
1
;
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeSClientHbKey
(
SCoder
*
pDecoder
,
SClientHbKey
*
pKey
)
{
if
(
tDecodeI64
(
pDecoder
,
&
pKey
->
tscRid
)
<
0
)
return
-
1
;
if
(
tDecodeI
32
(
pDecoder
,
&
pKey
->
hb
Type
)
<
0
)
return
-
1
;
if
(
tDecodeI
8
(
pDecoder
,
&
pKey
->
conn
Type
)
<
0
)
return
-
1
;
return
0
;
}
...
...
source/client/inc/clientInt.h
浏览文件 @
21a5e4f9
...
...
@@ -45,11 +45,6 @@ extern "C" {
#define HEARTBEAT_INTERVAL 1500 // ms
enum
{
CONN_TYPE__QUERY
=
1
,
CONN_TYPE__TMQ
,
};
typedef
struct
SAppInstInfo
SAppInstInfo
;
typedef
struct
{
...
...
@@ -84,8 +79,8 @@ typedef struct {
TdThread
thread
;
TdThreadMutex
lock
;
// used when app init and cleanup
SArray
*
appHbMgrs
;
// SArray<SAppHbMgr*> one for each cluster
FHbReqHandle
reqHandle
[
HEARTBEAT_TYPE
_MAX
];
FHbRspHandle
rspHandle
[
HEARTBEAT_TYPE
_MAX
];
FHbReqHandle
reqHandle
[
CONN_TYPE_
_MAX
];
FHbRspHandle
rspHandle
[
CONN_TYPE_
_MAX
];
}
SClientHbMgr
;
typedef
struct
SQueryExecMetric
{
...
...
@@ -307,7 +302,7 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key);
void
appHbMgrCleanup
(
void
);
// conn level
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int
32_t
hb
Type
);
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int
8_t
conn
Type
);
void
hbDeregisterConn
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
);
int
hbAddConnInfo
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
,
void
*
key
,
void
*
value
,
int32_t
keyLen
,
int32_t
valueLen
);
...
...
source/client/src/clientEnv.c
浏览文件 @
21a5e4f9
...
...
@@ -122,7 +122,7 @@ void closeAllRequests(SHashObj *pRequests) {
void
destroyTscObj
(
void
*
pObj
)
{
STscObj
*
pTscObj
=
pObj
;
SClientHbKey
connKey
=
{.
tscRid
=
pTscObj
->
id
,
.
hb
Type
=
pTscObj
->
connType
};
SClientHbKey
connKey
=
{.
tscRid
=
pTscObj
->
id
,
.
conn
Type
=
pTscObj
->
connType
};
hbDeregisterConn
(
pTscObj
->
pAppInfo
->
pAppHbMgr
,
connKey
);
atomic_sub_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
closeAllRequests
(
pTscObj
->
pRequests
);
...
...
source/client/src/clientHb.c
浏览文件 @
21a5e4f9
...
...
@@ -110,7 +110,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
static
int32_t
hbQueryHbRspHandle
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
)
{
SHbConnInfo
*
info
=
taosHashGet
(
pAppHbMgr
->
connInfo
,
&
pRsp
->
connKey
,
sizeof
(
SClientHbKey
));
if
(
NULL
==
info
)
{
tscWarn
(
"fail to get connInfo, may be dropped, refId:%"
PRIx64
", type:%d"
,
pRsp
->
connKey
.
tscRid
,
pRsp
->
connKey
.
hb
Type
);
tscWarn
(
"fail to get connInfo, may be dropped, refId:%"
PRIx64
", type:%d"
,
pRsp
->
connKey
.
tscRid
,
pRsp
->
connKey
.
conn
Type
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -224,7 +224,7 @@ static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code)
for
(
int32_t
i
=
0
;
i
<
rspNum
;
++
i
)
{
SClientHbRsp
*
rsp
=
taosArrayGet
(
pRsp
.
rsps
,
i
);
code
=
(
*
clientHbMgr
.
rspHandle
[
rsp
->
connKey
.
hb
Type
])((
*
pInst
)
->
pAppHbMgr
,
rsp
);
code
=
(
*
clientHbMgr
.
rspHandle
[
rsp
->
connKey
.
conn
Type
])((
*
pInst
)
->
pAppHbMgr
,
rsp
);
if
(
code
)
{
break
;
}
...
...
@@ -420,11 +420,11 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
}
void
hbMgrInitMqHbHandle
()
{
clientHbMgr
.
reqHandle
[
HEARTBEAT_TYPE
_QUERY
]
=
hbQueryHbReqHandle
;
clientHbMgr
.
reqHandle
[
HEARTBEAT_TYPE_
MQ
]
=
hbMqHbReqHandle
;
clientHbMgr
.
reqHandle
[
CONN_TYPE_
_QUERY
]
=
hbQueryHbReqHandle
;
clientHbMgr
.
reqHandle
[
CONN_TYPE__T
MQ
]
=
hbMqHbReqHandle
;
clientHbMgr
.
rspHandle
[
HEARTBEAT_TYPE
_QUERY
]
=
hbQueryHbRspHandle
;
clientHbMgr
.
rspHandle
[
HEARTBEAT_TYPE_
MQ
]
=
hbMqHbRspHandle
;
clientHbMgr
.
rspHandle
[
CONN_TYPE_
_QUERY
]
=
hbQueryHbRspHandle
;
clientHbMgr
.
rspHandle
[
CONN_TYPE__T
MQ
]
=
hbMqHbRspHandle
;
}
static
FORCE_INLINE
void
hbMgrInitHandle
()
{
...
...
@@ -458,7 +458,7 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
SHbConnInfo
*
info
=
taosHashGet
(
pAppHbMgr
->
connInfo
,
&
pOneReq
->
connKey
,
sizeof
(
SClientHbKey
));
if
(
info
)
{
code
=
(
*
clientHbMgr
.
reqHandle
[
pOneReq
->
connKey
.
hb
Type
])(
&
pOneReq
->
connKey
,
info
->
param
,
pOneReq
);
code
=
(
*
clientHbMgr
.
reqHandle
[
pOneReq
->
connKey
.
conn
Type
])(
&
pOneReq
->
connKey
,
info
->
param
,
pOneReq
);
if
(
code
)
{
pIter
=
taosHashIterate
(
pAppHbMgr
->
activeInfo
,
pIter
);
continue
;
...
...
@@ -692,22 +692,22 @@ int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, SHbConnInfo *
return
0
;
}
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int
32_t
hb
Type
)
{
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int
8_t
conn
Type
)
{
SClientHbKey
connKey
=
{
.
tscRid
=
tscRefId
,
.
hbType
=
hb
Type
,
.
connType
=
conn
Type
,
};
SHbConnInfo
info
=
{
0
};
switch
(
hb
Type
)
{
case
HEARTBEAT_TYPE
_QUERY
:
{
switch
(
conn
Type
)
{
case
CONN_TYPE_
_QUERY
:
{
int64_t
*
pClusterId
=
taosMemoryMalloc
(
sizeof
(
int64_t
));
*
pClusterId
=
clusterId
;
info
.
param
=
pClusterId
;
return
hbRegisterConnImpl
(
pAppHbMgr
,
connKey
,
&
info
);
}
case
HEARTBEAT_TYPE_
MQ
:
{
case
CONN_TYPE__T
MQ
:
{
return
0
;
}
default:
...
...
source/common/src/tmsg.c
浏览文件 @
21a5e4f9
...
...
@@ -3424,5 +3424,4 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
void
tFreeSCMCreateStreamReq
(
SCMCreateStreamReq
*
pReq
)
{
taosMemoryFreeClear
(
pReq
->
sql
);
taosMemoryFreeClear
(
pReq
->
ast
);
}
taosMemoryFreeClear
(
pReq
->
ast
)
\ No newline at end of file
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
21a5e4f9
...
...
@@ -343,7 +343,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
pBasic
->
connId
);
if
(
pConn
==
NULL
)
{
pConn
=
mndCreateConn
(
pMnode
,
connInfo
.
user
,
connInfo
.
clientIp
,
connInfo
.
clientPort
,
pBasic
->
pid
,
pBasic
->
app
,
0
);
pConn
=
mndCreateConn
(
pMnode
,
connInfo
.
user
,
CONN_TYPE__QUERY
,
connInfo
.
clientIp
,
connInfo
.
clientPort
,
pBasic
->
pid
,
pBasic
->
app
,
0
);
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, conn:%u is freed and failed to create new since %s"
,
connInfo
.
user
,
pBasic
->
connId
,
terrstr
());
return
-
1
;
...
...
@@ -451,9 +451,9 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
int32_t
sz
=
taosArrayGetSize
(
batchReq
.
reqs
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SClientHbReq
*
pHbReq
=
taosArrayGet
(
batchReq
.
reqs
,
i
);
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE
_QUERY
)
{
if
(
pHbReq
->
connKey
.
connType
==
CONN_TYPE_
_QUERY
)
{
mndProcessQueryHeartBeat
(
pMnode
,
&
pReq
->
rpcMsg
,
pHbReq
,
&
batchRsp
);
}
else
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_
MQ
)
{
}
else
if
(
pHbReq
->
connKey
.
connType
==
CONN_TYPE__T
MQ
)
{
SClientHbRsp
*
pRsp
=
mndMqHbBuildRsp
(
pMnode
,
pHbReq
);
if
(
pRsp
!=
NULL
)
{
taosArrayPush
(
batchRsp
.
rsps
,
pRsp
);
...
...
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
21a5e4f9
...
...
@@ -99,7 +99,7 @@ TEST_F(MndTestProfile, 04_HeartBeatMsg) {
SClientHbBatchReq
batchReq
=
{
0
};
batchReq
.
reqs
=
taosArrayInit
(
0
,
sizeof
(
SClientHbReq
));
SClientHbReq
req
=
{
0
};
req
.
connKey
=
{.
connId
=
123
,
.
hbType
=
HEARTBEAT_TYPE_
MQ
};
req
.
connKey
=
{.
connId
=
123
,
.
hbType
=
CONN_TYPE__T
MQ
};
req
.
info
=
taosHashInit
(
64
,
hbKeyHashFunc
,
1
,
HASH_ENTRY_LOCK
);
SKv
kv
=
{
0
};
kv
.
key
=
123
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录