Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2e40293b
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
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,发现更多精彩内容 >>
提交
2e40293b
编写于
1月 14, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test for new heartbeat
上级
aa9a5b6f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
45 addition
and
22 deletion
+45
-22
source/client/src/clientHb.c
source/client/src/clientHb.c
+24
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-1
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+1
-1
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+18
-18
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+1
-1
未找到文件。
source/client/src/clientHb.c
浏览文件 @
2e40293b
...
...
@@ -51,10 +51,14 @@ SClientHbBatchReq* hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
int32_t
connKeyCnt
=
atomic_load_32
(
&
pAppHbMgr
->
connKeyCnt
);
pBatchReq
->
reqs
=
taosArrayInit
(
connKeyCnt
,
sizeof
(
SClientHbReq
));
if
(
pAppHbMgr
->
activeInfo
==
NULL
)
{
return
NULL
;
}
void
*
pIter
=
taosHashIterate
(
pAppHbMgr
->
activeInfo
,
NULL
);
while
(
pIter
!=
NULL
)
{
taosArrayPush
(
pBatchReq
->
reqs
,
pIter
);
SClientHbReq
*
pOneReq
=
pIter
;
taosArrayPush
(
pBatchReq
->
reqs
,
pOneReq
);
taosHashClear
(
pOneReq
->
info
);
pIter
=
taosHashIterate
(
pAppHbMgr
->
activeInfo
,
pIter
);
...
...
@@ -84,7 +88,14 @@ static void* hbThreadFunc(void* param) {
int
sz
=
taosArrayGetSize
(
clientHbMgr
.
appHbMgrs
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SAppHbMgr
*
pAppHbMgr
=
taosArrayGet
(
clientHbMgr
.
appHbMgrs
,
i
);
int32_t
connCnt
=
atomic_load_32
(
&
pAppHbMgr
->
connKeyCnt
);
if
(
connCnt
==
0
)
{
continue
;
}
SClientHbBatchReq
*
pReq
=
hbGatherAllInfo
(
pAppHbMgr
);
if
(
pReq
==
NULL
)
{
continue
;
}
int
tlen
=
tSerializeSClientHbBatchReq
(
NULL
,
pReq
);
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
...
...
@@ -146,10 +157,22 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo) {
// init hash info
pAppHbMgr
->
activeInfo
=
taosHashInit
(
64
,
hbKeyHashFunc
,
1
,
HASH_ENTRY_LOCK
);
if
(
pAppHbMgr
->
activeInfo
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
free
(
pAppHbMgr
);
return
NULL
;
}
pAppHbMgr
->
activeInfo
->
freeFp
=
tFreeClientHbReq
;
// init getInfoFunc
pAppHbMgr
->
getInfoFuncs
=
taosHashInit
(
64
,
hbKeyHashFunc
,
1
,
HASH_ENTRY_LOCK
);
if
(
pAppHbMgr
->
getInfoFuncs
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
free
(
pAppHbMgr
);
return
NULL
;
}
taosArrayPush
(
clientHbMgr
.
appHbMgrs
,
&
pAppHbMgr
);
return
pAppHbMgr
;
}
...
...
source/client/src/clientImpl.c
浏览文件 @
2e40293b
...
...
@@ -116,7 +116,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
SAppInstInfo
*
p
=
calloc
(
1
,
sizeof
(
struct
SAppInstInfo
));
p
->
mgmtEp
=
epSet
;
p
->
pTransporter
=
openTransporter
(
user
,
secretEncrypt
,
tsNumOfCores
);
/*p->pAppHbMgr = appHbMgrInit(p);*/
p
->
pAppHbMgr
=
appHbMgrInit
(
p
);
taosHashPut
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
),
&
p
,
POINTER_BYTES
);
pInst
=
&
p
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
2e40293b
...
...
@@ -72,7 +72,7 @@ int processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
atomic_add_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
SClientHbKey
connKey
=
{.
connId
=
pConnect
->
connId
,
.
hbType
=
HEARTBEAT_TYPE_QUERY
};
/*hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, connKey, NULL);*/
hbRegisterConn
(
pTscObj
->
pAppInfo
->
pAppHbMgr
,
connKey
,
NULL
);
// pRequest->body.resInfo.pRspMsg = pMsg->pData;
tscDebug
(
"0x%"
PRIx64
" clusterId:%"
PRId64
", totalConn:%"
PRId64
,
pRequest
->
requestId
,
pConnect
->
clusterId
,
...
...
source/client/test/clientTests.cpp
浏览文件 @
2e40293b
...
...
@@ -147,29 +147,29 @@ TEST(testCase, connect_Test) {
// taos_close(pConn);
//}
//
TEST
(
testCase
,
create_db_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
//
TEST(testCase, create_db_Test) {
//
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
//
assert(pConn != NULL);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1 vgroups 2"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in create db, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
//
TAOS_RES* pRes = taos_query(pConn, "create database abc1 vgroups 2");
//
if (taos_errno(pRes) != 0) {
//
printf("error in create db, reason:%s\n", taos_errstr(pRes));
//
}
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
ASSERT_TRUE
(
pFields
==
NULL
);
//
TAOS_FIELD* pFields = taos_fetch_fields(pRes);
//
ASSERT_TRUE(pFields == NULL);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
ASSERT_EQ
(
numOfFields
,
0
);
//
int32_t numOfFields = taos_num_fields(pRes);
//
ASSERT_EQ(numOfFields, 0);
taos_free_result
(
pRes
);
//
taos_free_result(pRes);
pRes
=
taos_query
(
pConn
,
"create database abc1 vgroups 4"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in create db, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_close
(
pConn
);
}
//
pRes = taos_query(pConn, "create database abc1 vgroups 4");
//
if (taos_errno(pRes) != 0) {
//
printf("error in create db, reason:%s\n", taos_errstr(pRes));
//
}
//
taos_close(pConn);
//
}
//
//TEST(testCase, create_dnode_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
...
...
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
2e40293b
...
...
@@ -96,7 +96,6 @@ TEST_F(MndTestProfile, 03_ConnectMsg_Show) {
}
TEST_F
(
MndTestProfile
,
04
_HeartBeatMsg
)
{
SClientHbBatchReq
batchReq
;
batchReq
.
reqs
=
taosArrayInit
(
0
,
sizeof
(
SClientHbReq
));
SClientHbReq
req
=
{
0
};
...
...
@@ -127,6 +126,7 @@ TEST_F(MndTestProfile, 04_HeartBeatMsg) {
EXPECT_EQ
(
pRsp
->
connKey
.
connId
,
123
);
EXPECT_EQ
(
pRsp
->
connKey
.
hbType
,
HEARTBEAT_TYPE_MQ
);
EXPECT_EQ
(
pRsp
->
status
,
0
);
#if 0
int32_t contLen = sizeof(SHeartBeatReq);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录