Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57a722a6
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看板
提交
57a722a6
编写于
12月 05, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 rename test file
上级
ff86bc29
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
45 deletion
+45
-45
include/common/taosmsg.h
include/common/taosmsg.h
+12
-2
source/dnode/mgmt/impl/test/profile/profile.cpp
source/dnode/mgmt/impl/test/profile/profile.cpp
+2
-3
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+31
-40
未找到文件。
include/common/taosmsg.h
浏览文件 @
57a722a6
...
...
@@ -893,8 +893,18 @@ typedef struct {
}
SHeartBeatRsp
;
typedef
struct
{
char
queryId
[
TSDB_KILL_MSG_LEN
+
1
];
}
SKillQueryMsg
,
SKillConnMsg
;
int32_t
connId
;
int32_t
streamId
;
}
SKillStreamMsg
;
typedef
struct
{
int32_t
connId
;
int32_t
queryId
;
}
SKillQueryMsg
;
typedef
struct
{
int32_t
connId
;
}
SKillConnMsg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
...
...
source/dnode/mgmt/impl/test/profile/profile.cpp
浏览文件 @
57a722a6
...
...
@@ -21,7 +21,8 @@ class DndTestProfile : public ::testing::Test {
void
TearDown
()
override
{}
static
void
SetUpTestSuite
()
{
pServer
=
createServer
(
"/tmp/dndTestProfile"
,
"localhost"
,
9527
);
pServer
=
createServer
(
"/tmp/dndTestProfile"
,
"localhost"
,
7100
);
ASSERT
(
pServer
);
pClient
=
createClient
(
"root"
,
"taosdata"
);
}
...
...
@@ -38,7 +39,6 @@ SServer* DndTestProfile::pServer;
SClient
*
DndTestProfile
::
pClient
;
TEST_F
(
DndTestProfile
,
connectMsg_01
)
{
ASSERT_NE
(
pServer
,
nullptr
);
ASSERT_NE
(
pClient
,
nullptr
);
SConnectMsg
*
pReq
=
(
SConnectMsg
*
)
rpcMallocCont
(
sizeof
(
SConnectMsg
));
...
...
@@ -74,7 +74,6 @@ TEST_F(DndTestProfile, connectMsg_01) {
}
TEST_F
(
DndTestProfile
,
heartbeatMsg_01
)
{
ASSERT_NE
(
pServer
,
nullptr
);
ASSERT_NE
(
pClient
,
nullptr
);
SHeartBeatMsg
*
pReq
=
(
SHeartBeatMsg
*
)
rpcMallocCont
(
sizeof
(
SHeartBeatMsg
));
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
57a722a6
...
...
@@ -84,6 +84,12 @@ int32_t mndInitProfile(SMnode *pMnode) {
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndGetConnsMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndRetrieveConns
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndCancelGetNextConn
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndGetQueryMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndRetrieveQueries
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndCancelGetNextQuery
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndGetStreamMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndRetrieveStreams
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndCancelGetNextStream
);
return
0
;
}
...
...
@@ -122,15 +128,19 @@ static SConnObj *mndCreateConn(SMnode *pMnode, char *user, uint32_t ip, uint16_t
int32_t
keepTime
=
pMnode
->
shellActivityTimer
*
3
;
SConnObj
*
pConn
=
taosCachePut
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
),
&
connObj
,
sizeof
(
connObj
),
keepTime
*
1000
);
mDebug
(
"conn:%d, is created, user:%s"
,
connId
,
user
);
return
pConn
;
if
(
pConn
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"conn:%d, failed to put into cache since %s, user:%s"
,
connId
,
user
,
terrstr
());
return
NULL
;
}
else
{
mDebug
(
"conn:%d, is created, user:%s"
,
connId
,
user
);
return
pConn
;
}
}
static
void
mndFreeConn
(
SConnObj
*
pConn
)
{
tfree
(
pConn
->
pQueries
);
tfree
(
pConn
->
pStreams
);
tfree
(
pConn
);
mDebug
(
"conn:%d, is destroyed"
,
pConn
->
connId
);
}
...
...
@@ -224,6 +234,7 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
SConnectRsp
*
pRsp
=
rpcMallocCont
(
sizeof
(
SConnectRsp
));
if
(
pRsp
==
NULL
)
{
mndReleaseConn
(
pMnode
,
pConn
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"user:%s, failed to login from %s while create rsp since %s"
,
pMsg
->
user
,
ip
,
terrstr
());
return
-
1
;
...
...
@@ -241,6 +252,7 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
pRsp
->
clusterId
=
htonl
(
pMnode
->
clusterId
);
pRsp
->
connId
=
htonl
(
pConn
->
connId
);
mndGetMnodeEpSet
(
pMnode
,
&
pRsp
->
epSet
);
mndReleaseConn
(
pMnode
,
pConn
);
pMsg
->
contLen
=
sizeof
(
SConnectRsp
);
pMsg
->
pCont
=
pRsp
;
...
...
@@ -354,28 +366,17 @@ static int32_t mndProcessKillQueryMsg(SMnodeMsg *pMsg) {
mndReleaseUser
(
pMnode
,
pUser
);
SKillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
int32_t
connId
=
htonl
(
pKill
->
connId
);
int32_t
queryId
=
htonl
(
pKill
->
queryId
);
mInfo
(
"kill query msg is received, queryId:%s"
,
pKill
->
queryId
);
const
char
delim
=
':'
;
char
*
connIdStr
=
strtok
(
pKill
->
queryId
,
&
delim
);
char
*
queryIdStr
=
strtok
(
NULL
,
&
delim
);
if
(
queryIdStr
==
NULL
||
connIdStr
==
NULL
)
{
mError
(
"failed to kill query, queryId:%s"
,
pKill
->
queryId
);
terrno
=
TSDB_CODE_MND_INVALID_QUERY_ID
;
return
-
1
;
}
int32_t
queryId
=
(
int32_t
)
strtol
(
queryIdStr
,
NULL
,
10
);
int32_t
connId
=
atoi
(
connIdStr
);
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
));
if
(
pConn
==
NULL
)
{
mError
(
"connId:%
s, failed to kill queryId:%d, conn not exist"
,
connIdStr
,
queryId
);
mError
(
"connId:%
d, failed to kill queryId:%d, conn not exist"
,
connId
,
queryId
);
terrno
=
TSDB_CODE_MND_INVALID_CONN_ID
;
return
-
1
;
}
else
{
mInfo
(
"connId:%
s, queryId:%d is killed by user:%s"
,
connIdStr
,
queryId
,
pMsg
->
user
);
mInfo
(
"connId:%
d, queryId:%d is killed by user:%s"
,
connId
,
queryId
,
pMsg
->
user
);
pConn
->
queryId
=
queryId
;
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)
&
pConn
,
false
);
return
0
;
...
...
@@ -395,29 +396,18 @@ static int32_t mndProcessKillStreamMsg(SMnodeMsg *pMsg) {
}
mndReleaseUser
(
pMnode
,
pUser
);
SKillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
mInfo
(
"kill stream msg is received, streamId:%s"
,
pKill
->
queryId
);
const
char
delim
=
':'
;
char
*
connIdStr
=
strtok
(
pKill
->
queryId
,
&
delim
);
char
*
streamIdStr
=
strtok
(
NULL
,
&
delim
);
if
(
streamIdStr
==
NULL
||
connIdStr
==
NULL
)
{
mError
(
"failed to kill stream, streamId:%s"
,
pKill
->
queryId
);
terrno
=
TSDB_CODE_MND_INVALID_STREAM_ID
;
return
-
1
;
}
int32_t
streamId
=
(
int32_t
)
strtol
(
streamIdStr
,
NULL
,
10
);
int32_t
connId
=
atoi
(
connIdStr
);
SKillStreamMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
int32_t
connId
=
htonl
(
pKill
->
connId
);
int32_t
streamId
=
htonl
(
pKill
->
streamId
);
mDebug
(
"kill stream msg is received, streamId:%s"
,
streamId
);
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
));
if
(
pConn
==
NULL
)
{
mError
(
"connId:%
s, failed to kill streamId:%d, conn not exist"
,
connIdStr
,
streamId
);
mError
(
"connId:%
d, failed to kill streamId:%d, conn not exist"
,
connId
,
streamId
);
terrno
=
TSDB_CODE_MND_INVALID_CONN_ID
;
return
-
1
;
}
else
{
mInfo
(
"connId:%
s, streamId:%d is killed by user:%s"
,
connIdStr
,
streamId
,
pMsg
->
user
);
mInfo
(
"connId:%
d, streamId:%d is killed by user:%s"
,
connId
,
streamId
,
pMsg
->
user
);
pConn
->
streamId
=
streamId
;
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)
&
pConn
,
false
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -438,14 +428,15 @@ static int32_t mndProcessKillConnectionMsg(SMnodeMsg *pMsg) {
mndReleaseUser
(
pMnode
,
pUser
);
SKillConnMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
int32_t
connId
=
atoi
(
pKill
->
queryId
);
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
));
int32_t
connId
=
htonl
(
pKill
->
connId
);
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
));
if
(
pConn
==
NULL
)
{
mError
(
"connId:%s, failed to kill
, conn not exist"
,
pKill
->
query
Id
);
mError
(
"connId:%s, failed to kill
connection, conn not exist"
,
conn
Id
);
terrno
=
TSDB_CODE_MND_INVALID_CONN_ID
;
return
-
1
;
}
else
{
mInfo
(
"connId:%s, is killed by user:%s"
,
pKill
->
query
Id
,
pMsg
->
user
);
mInfo
(
"connId:%s, is killed by user:%s"
,
conn
Id
,
pMsg
->
user
);
pConn
->
killed
=
1
;
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)
&
pConn
,
false
);
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录