Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d10df1e3
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看板
提交
d10df1e3
编写于
1月 06, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
11a07e7d
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
158 addition
and
145 deletion
+158
-145
include/common/tmsg.h
include/common/tmsg.h
+4
-9
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-2
source/dnode/mgmt/impl/test/CMakeLists.txt
source/dnode/mgmt/impl/test/CMakeLists.txt
+0
-1
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+69
-69
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+5
-5
source/dnode/mnode/impl/test/CMakeLists.txt
source/dnode/mnode/impl/test/CMakeLists.txt
+1
-0
source/dnode/mnode/impl/test/profile/CMakeLists.txt
source/dnode/mnode/impl/test/profile/CMakeLists.txt
+11
-0
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+48
-48
source/dnode/mnode/impl/test/show/show.cpp
source/dnode/mnode/impl/test/show/show.cpp
+3
-3
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+2
-2
src/client/src/tscServer.c
src/client/src/tscServer.c
+5
-5
tests/script/general/table/basic1.sim
tests/script/general/table/basic1.sim
+8
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
d10df1e3
...
...
@@ -302,7 +302,7 @@ typedef struct {
char
app
[
TSDB_APP_NAME_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
int64_t
startTime
;
}
SConnect
Msg
;
}
SConnect
Req
;
typedef
struct
SEpSet
{
int8_t
inUse
;
...
...
@@ -898,7 +898,7 @@ typedef struct {
int32_t
numOfStreams
;
char
app
[
TSDB_APP_NAME_LEN
];
char
pData
[];
}
SHeartBeat
Msg
;
}
SHeartBeat
Req
;
typedef
struct
{
int32_t
connId
;
...
...
@@ -911,19 +911,14 @@ typedef struct {
SEpSet
epSet
;
}
SHeartBeatRsp
;
typedef
struct
{
int32_t
connId
;
int32_t
streamId
;
}
SKillStreamMsg
;
typedef
struct
{
int32_t
connId
;
int32_t
queryId
;
}
SKillQuery
Msg
;
}
SKillQuery
Req
;
typedef
struct
{
int32_t
connId
;
}
SKillConn
Msg
;
}
SKillConn
Req
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
...
...
source/client/src/clientImpl.c
浏览文件 @
d10df1e3
...
...
@@ -395,13 +395,13 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj *pRequest) {
}
pMsgSendInfo
->
msgType
=
TDMT_MND_CONNECT
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SConnect
Msg
);
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SConnect
Req
);
pMsgSendInfo
->
requestObjRefId
=
pRequest
->
self
;
pMsgSendInfo
->
requestId
=
pRequest
->
requestId
;
pMsgSendInfo
->
fp
=
handleRequestRspFp
[
TMSG_INDEX
(
pMsgSendInfo
->
msgType
)];
pMsgSendInfo
->
param
=
pRequest
;
SConnect
Msg
*
pConnect
=
calloc
(
1
,
sizeof
(
SConnectMsg
));
SConnect
Req
*
pConnect
=
calloc
(
1
,
sizeof
(
SConnectReq
));
if
(
pConnect
==
NULL
)
{
tfree
(
pMsgSendInfo
);
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
source/dnode/mgmt/impl/test/CMakeLists.txt
浏览文件 @
d10df1e3
...
...
@@ -10,7 +10,6 @@ add_subdirectory(db)
add_subdirectory
(
dnode
)
# add_subdirectory(func)
add_subdirectory
(
mnode
)
add_subdirectory
(
profile
)
add_subdirectory
(
stb
)
# add_subdirectory(sync)
# add_subdirectory(telem)
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
d10df1e3
...
...
@@ -47,14 +47,14 @@ static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId);
static
void
mndReleaseConn
(
SMnode
*
pMnode
,
SConnObj
*
pConn
);
static
void
*
mndGetNextConn
(
SMnode
*
pMnode
,
void
*
pIter
,
SConnObj
**
pConn
);
static
void
mndCancelGetNextConn
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessHeartBeat
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessConnect
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessKillQuery
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessKillConn
ectionMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndProcessHeartBeat
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessConnect
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessKillQuery
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessKillConn
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextQuery
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitProfile
(
SMnode
*
pMnode
)
{
...
...
@@ -68,10 +68,10 @@ int32_t mndInitProfile(SMnode *pMnode) {
return
-
1
;
}
mndSetMsgHandle
(
pMnode
,
TDMT_MND_HEARTBEAT
,
mndProcessHeartBeat
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CONNECT
,
mndProcessConnect
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQuery
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConn
ectionMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_HEARTBEAT
,
mndProcessHeartBeat
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CONNECT
,
mndProcessConnect
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQuery
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConn
Req
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndGetConnsMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndRetrieveConns
);
...
...
@@ -178,35 +178,35 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
taosHashCancelIterate
(
pMgmt
->
cache
->
pHashTable
,
pIter
);
}
static
int32_t
mndProcessConnect
Msg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
SConnect
Msg
*
pReq
=
pMsg
->
rpcMsg
.
pCont
;
p
Req
->
pid
=
htonl
(
p
Req
->
pid
);
p
Req
->
startTime
=
htobe64
(
p
Req
->
startTime
);
static
int32_t
mndProcessConnect
Req
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SConnect
Req
*
pConnReq
=
pReq
->
rpcMsg
.
pCont
;
p
ConnReq
->
pid
=
htonl
(
pConn
Req
->
pid
);
p
ConnReq
->
startTime
=
htobe64
(
pConn
Req
->
startTime
);
SRpcConnInfo
info
=
{
0
};
if
(
rpcGetConnInfo
(
p
Msg
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
mError
(
"user:%s, failed to login while get connection info since %s"
,
p
Msg
->
user
,
terrstr
());
if
(
rpcGetConnInfo
(
p
Req
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
mError
(
"user:%s, failed to login while get connection info since %s"
,
p
Req
->
user
,
terrstr
());
return
-
1
;
}
char
ip
[
30
];
taosIp2String
(
info
.
clientIp
,
ip
);
if
(
pReq
->
db
[
0
])
{
snprintf
(
p
Msg
->
db
,
TSDB_DB_FNAME_LEN
,
"%d%s%s"
,
pMsg
->
acctId
,
TS_PATH_DELIMITER
,
p
Req
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
p
Msg
->
db
);
if
(
p
Conn
Req
->
db
[
0
])
{
snprintf
(
p
Req
->
db
,
TSDB_DB_FNAME_LEN
,
"%d%s%s"
,
pReq
->
acctId
,
TS_PATH_DELIMITER
,
pConn
Req
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
p
Req
->
db
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB
;
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
p
Msg
->
user
,
ip
,
p
Req
->
db
,
terrstr
());
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
p
Req
->
user
,
ip
,
pConn
Req
->
db
,
terrstr
());
return
-
1
;
}
mndReleaseDb
(
pMnode
,
pDb
);
}
SConnObj
*
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
p
Req
->
pid
,
pReq
->
app
,
p
Req
->
startTime
);
SConnObj
*
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
p
ConnReq
->
pid
,
pConnReq
->
app
,
pConn
Req
->
startTime
);
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
p
Msg
->
user
,
ip
,
terrstr
());
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
p
Req
->
user
,
ip
,
terrstr
());
return
-
1
;
}
...
...
@@ -214,11 +214,11 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
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"
,
p
Msg
->
user
,
ip
,
terrstr
());
mError
(
"user:%s, failed to login from %s while create rsp since %s"
,
p
Req
->
user
,
ip
,
terrstr
());
return
-
1
;
}
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Msg
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Req
->
user
);
if
(
pUser
!=
NULL
)
{
pRsp
->
acctId
=
htonl
(
pUser
->
acctId
);
pRsp
->
superUser
=
pUser
->
superUser
;
...
...
@@ -230,16 +230,16 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
mndGetMnodeEpSet
(
pMnode
,
&
pRsp
->
epSet
);
mndReleaseConn
(
pMnode
,
pConn
);
p
Msg
->
contLen
=
sizeof
(
SConnectRsp
);
p
Msg
->
pCont
=
pRsp
;
p
Req
->
contLen
=
sizeof
(
SConnectRsp
);
p
Req
->
pCont
=
pRsp
;
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
info
.
user
,
ip
,
pConn
->
id
,
pReq
->
app
);
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
info
.
user
,
ip
,
pConn
->
id
,
p
Conn
Req
->
app
);
return
0
;
}
static
int32_t
mndSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeat
Msg
*
pMsg
)
{
static
int32_t
mndSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeat
Req
*
pReq
)
{
pConn
->
numOfQueries
=
0
;
int32_t
numOfQueries
=
htonl
(
p
Msg
->
numOfQueries
);
int32_t
numOfQueries
=
htonl
(
p
Req
->
numOfQueries
);
if
(
numOfQueries
>
0
)
{
if
(
pConn
->
pQueries
==
NULL
)
{
...
...
@@ -250,38 +250,38 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatMsg *pMsg) {
int32_t
saveSize
=
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
);
if
(
saveSize
>
0
&&
pConn
->
pQueries
!=
NULL
)
{
memcpy
(
pConn
->
pQueries
,
p
Msg
->
pData
,
saveSize
);
memcpy
(
pConn
->
pQueries
,
p
Req
->
pData
,
saveSize
);
}
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndProcessHeartBeat
Msg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndProcessHeartBeat
Req
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SHeartBeat
Msg
*
pReq
=
pMsg
->
rpcMsg
.
pCont
;
p
Req
->
connId
=
htonl
(
pReq
->
connId
);
p
Req
->
pid
=
htonl
(
pReq
->
pid
);
SHeartBeat
Req
*
pHeartbeat
=
pReq
->
rpcMsg
.
pCont
;
p
Heartbeat
->
connId
=
htonl
(
pHeartbeat
->
connId
);
p
Heartbeat
->
pid
=
htonl
(
pHeartbeat
->
pid
);
SRpcConnInfo
info
=
{
0
};
if
(
rpcGetConnInfo
(
p
Msg
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
mError
(
"user:%s, connId:%d failed to process hb since %s"
,
p
Msg
->
user
,
pReq
->
connId
,
terrstr
());
if
(
rpcGetConnInfo
(
p
Req
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
mError
(
"user:%s, connId:%d failed to process hb since %s"
,
p
Req
->
user
,
pHeartbeat
->
connId
,
terrstr
());
return
-
1
;
}
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
p
Req
->
connId
);
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
p
Heartbeat
->
connId
);
if
(
pConn
==
NULL
)
{
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
p
Req
->
pid
,
pReq
->
app
,
0
);
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
p
Heartbeat
->
pid
,
pHeartbeat
->
app
,
0
);
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, conn:%d is freed and failed to create new
conn since %s"
,
pMsg
->
user
,
pReq
->
connId
,
terrstr
());
mError
(
"user:%s, conn:%d is freed and failed to create new
since %s"
,
pReq
->
user
,
pHeartbeat
->
connId
,
terrstr
());
return
-
1
;
}
else
{
mDebug
(
"user:%s, conn:%d is freed and create a new conn:%d"
,
p
Msg
->
user
,
pReq
->
connId
,
pConn
->
id
);
mDebug
(
"user:%s, conn:%d is freed and create a new conn:%d"
,
p
Req
->
user
,
pHeartbeat
->
connId
,
pConn
->
id
);
}
}
else
if
(
pConn
->
killed
)
{
mError
(
"user:%s, conn:%d is already killed"
,
p
Msg
->
user
,
pConn
->
id
);
mError
(
"user:%s, conn:%d is already killed"
,
p
Req
->
user
,
pConn
->
id
);
terrno
=
TSDB_CODE_MND_INVALID_CONNECTION
;
return
-
1
;
}
else
{
...
...
@@ -304,11 +304,11 @@ static int32_t mndProcessHeartBeatMsg(SMnodeMsg *pMsg) {
if
(
pRsp
==
NULL
)
{
mndReleaseConn
(
pMnode
,
pConn
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"user:%s, conn:%d failed to process hb while
create rsp since %s"
,
pMsg
->
user
,
pReq
->
connId
,
terrstr
());
mError
(
"user:%s, conn:%d failed to process hb while
since %s"
,
pReq
->
user
,
pHeartbeat
->
connId
,
terrstr
());
return
-
1
;
}
mndSaveQueryStreamList
(
pConn
,
p
Req
);
mndSaveQueryStreamList
(
pConn
,
p
Heartbeat
);
if
(
pConn
->
killed
!=
0
)
{
pRsp
->
killConnection
=
1
;
}
...
...
@@ -324,16 +324,16 @@ static int32_t mndProcessHeartBeatMsg(SMnodeMsg *pMsg) {
mndGetMnodeEpSet
(
pMnode
,
&
pRsp
->
epSet
);
mndReleaseConn
(
pMnode
,
pConn
);
p
Msg
->
contLen
=
sizeof
(
SConnectRsp
);
p
Msg
->
pCont
=
pRsp
;
p
Req
->
contLen
=
sizeof
(
SConnectRsp
);
p
Req
->
pCont
=
pRsp
;
return
0
;
}
static
int32_t
mndProcessKillQuery
Msg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndProcessKillQuery
Req
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Msg
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Req
->
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
...
...
@@ -342,7 +342,7 @@ static int32_t mndProcessKillQueryMsg(SMnodeMsg *pMsg) {
}
mndReleaseUser
(
pMnode
,
pUser
);
SKillQuery
Msg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
SKillQuery
Req
*
pKill
=
pReq
->
rpcMsg
.
pCont
;
int32_t
connId
=
htonl
(
pKill
->
connId
);
int32_t
queryId
=
htonl
(
pKill
->
queryId
);
mInfo
(
"kill query msg is received, queryId:%d"
,
pKill
->
queryId
);
...
...
@@ -353,18 +353,18 @@ static int32_t mndProcessKillQueryMsg(SMnodeMsg *pMsg) {
terrno
=
TSDB_CODE_MND_INVALID_CONN_ID
;
return
-
1
;
}
else
{
mInfo
(
"connId:%d, queryId:%d is killed by user:%s"
,
connId
,
queryId
,
p
Msg
->
user
);
mInfo
(
"connId:%d, queryId:%d is killed by user:%s"
,
connId
,
queryId
,
p
Req
->
user
);
pConn
->
queryId
=
queryId
;
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)
&
pConn
,
false
);
return
0
;
}
}
static
int32_t
mndProcessKillConn
ectionMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndProcessKillConn
Req
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Msg
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Req
->
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
...
...
@@ -373,7 +373,7 @@ static int32_t mndProcessKillConnectionMsg(SMnodeMsg *pMsg) {
}
mndReleaseUser
(
pMnode
,
pUser
);
SKillConn
Msg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
SKillConn
Req
*
pKill
=
pReq
->
rpcMsg
.
pCont
;
int32_t
connId
=
htonl
(
pKill
->
connId
);
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
));
...
...
@@ -382,18 +382,18 @@ static int32_t mndProcessKillConnectionMsg(SMnodeMsg *pMsg) {
terrno
=
TSDB_CODE_MND_INVALID_CONN_ID
;
return
-
1
;
}
else
{
mInfo
(
"connId:%d, is killed by user:%s"
,
connId
,
p
Msg
->
user
);
mInfo
(
"connId:%d, is killed by user:%s"
,
connId
,
p
Req
->
user
);
pConn
->
killed
=
1
;
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)
&
pConn
,
false
);
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Msg
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Req
->
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
...
...
@@ -464,8 +464,8 @@ static int32_t mndGetConnsMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
return
0
;
}
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
int32_t
numOfRows
=
0
;
SConnObj
*
pConn
=
NULL
;
int32_t
cols
=
0
;
...
...
@@ -518,11 +518,11 @@ static int32_t mndRetrieveConns(SMnodeMsg *pMsg, SShowObj *pShow, char *data, in
return
numOfRows
;
}
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Msg
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
p
Req
->
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
...
...
@@ -633,8 +633,8 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
return
0
;
}
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
int32_t
numOfRows
=
0
;
SConnObj
*
pConn
=
NULL
;
int32_t
cols
=
0
;
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
d10df1e3
...
...
@@ -124,20 +124,20 @@ static int32_t mndProcessShowReq(SMnodeMsg *pReq) {
if
(
type
<=
TSDB_MGMT_TABLE_START
||
type
>=
TSDB_MGMT_TABLE_MAX
)
{
terrno
=
TSDB_CODE_MND_INVALID_MSG_TYPE
;
mError
(
"failed to process show
msg
since %s"
,
terrstr
());
mError
(
"failed to process show
-meta req
since %s"
,
terrstr
());
return
-
1
;
}
ShowMetaFp
metaFp
=
pMgmt
->
metaFps
[
type
];
if
(
metaFp
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_MSG_TYPE
;
mError
(
"failed to process show-meta
msg
:%s since %s"
,
mndShowStr
(
type
),
terrstr
());
mError
(
"failed to process show-meta
req
:%s since %s"
,
mndShowStr
(
type
),
terrstr
());
return
-
1
;
}
SShowObj
*
pShow
=
mndCreateShowObj
(
pMnode
,
pShowReq
);
if
(
pShow
==
NULL
)
{
mError
(
"failed to process show-meta
msg
:%s since %s"
,
mndShowStr
(
type
),
terrstr
());
mError
(
"failed to process show-meta
req
:%s since %s"
,
mndShowStr
(
type
),
terrstr
());
return
-
1
;
}
...
...
@@ -146,7 +146,7 @@ static int32_t mndProcessShowReq(SMnodeMsg *pReq) {
if
(
pRsp
==
NULL
)
{
mndReleaseShowObj
(
pShow
,
true
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"show:0x%"
PRIx64
", failed to process show-meta
msg
:%s since malloc rsp error"
,
pShow
->
id
,
mError
(
"show:0x%"
PRIx64
", failed to process show-meta
req
:%s since malloc rsp error"
,
pShow
->
id
,
mndShowStr
(
type
));
return
-
1
;
}
...
...
@@ -181,7 +181,7 @@ static int32_t mndProcessRetrieveReq(SMnodeMsg *pReq) {
SShowObj
*
pShow
=
mndAcquireShowObj
(
pMnode
,
showId
);
if
(
pShow
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_SHOWOBJ
;
mError
(
"failed to process show-retrieve
msg
:%p since %s"
,
pShow
,
terrstr
());
mError
(
"failed to process show-retrieve
req
:%p since %s"
,
pShow
,
terrstr
());
return
-
1
;
}
...
...
source/dnode/mnode/impl/test/CMakeLists.txt
浏览文件 @
d10df1e3
...
...
@@ -7,3 +7,4 @@ add_subdirectory(qnode)
add_subdirectory
(
snode
)
add_subdirectory
(
bnode
)
add_subdirectory
(
show
)
add_subdirectory
(
profile
)
source/dnode/m
gmt
/impl/test/profile/CMakeLists.txt
→
source/dnode/m
node
/impl/test/profile/CMakeLists.txt
浏览文件 @
d10df1e3
aux_source_directory
(
. PROFILE_SRC
)
add_executable
(
d
node_test_profile
${
PROFILE_SRC
}
)
add_executable
(
m
node_test_profile
${
PROFILE_SRC
}
)
target_link_libraries
(
d
node_test_profile
m
node_test_profile
PUBLIC sut
)
add_test
(
NAME
d
node_test_profile
COMMAND
d
node_test_profile
NAME
m
node_test_profile
COMMAND
m
node_test_profile
)
source/dnode/m
gmt
/impl/test/profile/profile.cpp
→
source/dnode/m
node
/impl/test/profile/profile.cpp
浏览文件 @
d10df1e3
/**
* @file profile.cpp
* @author slguan (slguan@taosdata.com)
* @brief
DNODE module profile-msg
tests
* @version
0.1
* @date 202
1-12-15
* @brief
MNODE module profile
tests
* @version
1.0
* @date 202
2-01-06
*
* @copyright Copyright (c) 202
1
* @copyright Copyright (c) 202
2
*
*/
#include "sut.h"
class
D
ndTestProfile
:
public
::
testing
::
Test
{
class
M
ndTestProfile
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/
dnode_test_profile"
,
9080
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/
mnode_test_profile"
,
9022
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
@@ -24,15 +24,15 @@ class DndTestProfile : public ::testing::Test {
void
TearDown
()
override
{}
};
Testbase
D
ndTestProfile
::
test
;
int32_t
D
ndTestProfile
::
connId
;
Testbase
M
ndTestProfile
::
test
;
int32_t
M
ndTestProfile
::
connId
;
TEST_F
(
D
ndTestProfile
,
01
_ConnectMsg
)
{
int32_t
contLen
=
sizeof
(
SConnect
Msg
);
TEST_F
(
M
ndTestProfile
,
01
_ConnectMsg
)
{
int32_t
contLen
=
sizeof
(
SConnect
Req
);
SConnect
Msg
*
pReq
=
(
SConnectMsg
*
)
rpcMallocCont
(
contLen
);
SConnect
Req
*
pReq
=
(
SConnectReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
pid
=
htonl
(
1234
);
strcpy
(
pReq
->
app
,
"
d
node_test_profile"
);
strcpy
(
pReq
->
app
,
"
m
node_test_profile"
);
strcpy
(
pReq
->
db
,
""
);
SRpcMsg
*
pMsg
=
test
.
SendReq
(
TDMT_MND_CONNECT
,
pReq
,
contLen
);
...
...
@@ -53,18 +53,18 @@ TEST_F(DndTestProfile, 01_ConnectMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
80
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
connId
=
pRsp
->
connId
;
}
TEST_F
(
D
ndTestProfile
,
02
_ConnectMsg_InvalidDB
)
{
int32_t
contLen
=
sizeof
(
SConnect
Msg
);
TEST_F
(
M
ndTestProfile
,
02
_ConnectMsg_InvalidDB
)
{
int32_t
contLen
=
sizeof
(
SConnect
Req
);
SConnect
Msg
*
pReq
=
(
SConnectMsg
*
)
rpcMallocCont
(
contLen
);
SConnect
Req
*
pReq
=
(
SConnectReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
pid
=
htonl
(
1234
);
strcpy
(
pReq
->
app
,
"
d
node_test_profile"
);
strcpy
(
pReq
->
app
,
"
m
node_test_profile"
);
strcpy
(
pReq
->
db
,
"invalid_db"
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CONNECT
,
pReq
,
contLen
);
...
...
@@ -73,7 +73,7 @@ TEST_F(DndTestProfile, 02_ConnectMsg_InvalidDB) {
ASSERT_EQ
(
pRsp
->
contLen
,
0
);
}
TEST_F
(
D
ndTestProfile
,
03
_ConnectMsg_Show
)
{
TEST_F
(
M
ndTestProfile
,
03
_ConnectMsg_Show
)
{
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_CONNS
,
""
);
CHECK_META
(
"show connections"
,
7
);
CHECK_SCHEMA
(
0
,
TSDB_DATA_TYPE_INT
,
4
,
"connId"
);
...
...
@@ -88,22 +88,22 @@ TEST_F(DndTestProfile, 03_ConnectMsg_Show) {
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckInt32
(
1
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"
d
node_test_profile"
,
TSDB_APP_NAME_LEN
);
CheckBinary
(
"
m
node_test_profile"
,
TSDB_APP_NAME_LEN
);
CheckInt32
(
1234
);
IgnoreBinary
(
TSDB_IPv4ADDR_LEN
+
6
);
CheckTimestamp
();
CheckTimestamp
();
}
TEST_F
(
D
ndTestProfile
,
04
_HeartBeatMsg
)
{
int32_t
contLen
=
sizeof
(
SHeartBeat
Msg
);
TEST_F
(
M
ndTestProfile
,
04
_HeartBeatMsg
)
{
int32_t
contLen
=
sizeof
(
SHeartBeat
Req
);
SHeartBeat
Msg
*
pReq
=
(
SHeartBeatMsg
*
)
rpcMallocCont
(
contLen
);
SHeartBeat
Req
*
pReq
=
(
SHeartBeatReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
connId
);
pReq
->
pid
=
htonl
(
1234
);
pReq
->
numOfQueries
=
htonl
(
0
);
pReq
->
numOfStreams
=
htonl
(
0
);
strcpy
(
pReq
->
app
,
"
d
node_test_profile"
);
strcpy
(
pReq
->
app
,
"
m
node_test_profile"
);
SRpcMsg
*
pMsg
=
test
.
SendReq
(
TDMT_MND_HEARTBEAT
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
@@ -127,15 +127,15 @@ TEST_F(DndTestProfile, 04_HeartBeatMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
80
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
}
TEST_F
(
D
ndTestProfile
,
05
_KillConnMsg
)
{
TEST_F
(
M
ndTestProfile
,
05
_KillConnMsg
)
{
{
int32_t
contLen
=
sizeof
(
SKillConn
Msg
);
int32_t
contLen
=
sizeof
(
SKillConn
Req
);
SKillConn
Msg
*
pReq
=
(
SKillConnMsg
*
)
rpcMallocCont
(
contLen
);
SKillConn
Req
*
pReq
=
(
SKillConnReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
connId
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_KILL_CONN
,
pReq
,
contLen
);
...
...
@@ -144,14 +144,14 @@ TEST_F(DndTestProfile, 05_KillConnMsg) {
}
{
int32_t
contLen
=
sizeof
(
SHeartBeat
Msg
);
int32_t
contLen
=
sizeof
(
SHeartBeat
Req
);
SHeartBeat
Msg
*
pReq
=
(
SHeartBeatMsg
*
)
rpcMallocCont
(
contLen
);
SHeartBeat
Req
*
pReq
=
(
SHeartBeatReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
connId
);
pReq
->
pid
=
htonl
(
1234
);
pReq
->
numOfQueries
=
htonl
(
0
);
pReq
->
numOfStreams
=
htonl
(
0
);
strcpy
(
pReq
->
app
,
"
d
node_test_profile"
);
strcpy
(
pReq
->
app
,
"
m
node_test_profile"
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_HEARTBEAT
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -160,11 +160,11 @@ TEST_F(DndTestProfile, 05_KillConnMsg) {
}
{
int32_t
contLen
=
sizeof
(
SConnect
Msg
);
int32_t
contLen
=
sizeof
(
SConnect
Req
);
SConnect
Msg
*
pReq
=
(
SConnectMsg
*
)
rpcMallocCont
(
contLen
);
SConnect
Req
*
pReq
=
(
SConnectReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
pid
=
htonl
(
1234
);
strcpy
(
pReq
->
app
,
"
d
node_test_profile"
);
strcpy
(
pReq
->
app
,
"
m
node_test_profile"
);
strcpy
(
pReq
->
db
,
""
);
SRpcMsg
*
pMsg
=
test
.
SendReq
(
TDMT_MND_CONNECT
,
pReq
,
contLen
);
...
...
@@ -185,17 +185,17 @@ TEST_F(DndTestProfile, 05_KillConnMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
80
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
connId
=
pRsp
->
connId
;
}
}
TEST_F
(
D
ndTestProfile
,
06
_KillConnMsg_InvalidConn
)
{
int32_t
contLen
=
sizeof
(
SKillConn
Msg
);
TEST_F
(
M
ndTestProfile
,
06
_KillConnMsg_InvalidConn
)
{
int32_t
contLen
=
sizeof
(
SKillConn
Req
);
SKillConn
Msg
*
pReq
=
(
SKillConnMsg
*
)
rpcMallocCont
(
contLen
);
SKillConn
Req
*
pReq
=
(
SKillConnReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
2345
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_KILL_CONN
,
pReq
,
contLen
);
...
...
@@ -203,11 +203,11 @@ TEST_F(DndTestProfile, 06_KillConnMsg_InvalidConn) {
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_INVALID_CONN_ID
);
}
TEST_F
(
D
ndTestProfile
,
07
_KillQueryMsg
)
{
TEST_F
(
M
ndTestProfile
,
07
_KillQueryMsg
)
{
{
int32_t
contLen
=
sizeof
(
SKillQuery
Msg
);
int32_t
contLen
=
sizeof
(
SKillQuery
Req
);
SKillQuery
Msg
*
pReq
=
(
SKillQueryMsg
*
)
rpcMallocCont
(
contLen
);
SKillQuery
Req
*
pReq
=
(
SKillQueryReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
connId
);
pReq
->
queryId
=
htonl
(
1234
);
...
...
@@ -218,14 +218,14 @@ TEST_F(DndTestProfile, 07_KillQueryMsg) {
}
{
int32_t
contLen
=
sizeof
(
SHeartBeat
Msg
);
int32_t
contLen
=
sizeof
(
SHeartBeat
Req
);
SHeartBeat
Msg
*
pReq
=
(
SHeartBeatMsg
*
)
rpcMallocCont
(
contLen
);
SHeartBeat
Req
*
pReq
=
(
SHeartBeatReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
connId
);
pReq
->
pid
=
htonl
(
1234
);
pReq
->
numOfQueries
=
htonl
(
0
);
pReq
->
numOfStreams
=
htonl
(
0
);
strcpy
(
pReq
->
app
,
"
d
node_test_profile"
);
strcpy
(
pReq
->
app
,
"
m
node_test_profile"
);
SRpcMsg
*
pMsg
=
test
.
SendReq
(
TDMT_MND_HEARTBEAT
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
@@ -249,15 +249,15 @@ TEST_F(DndTestProfile, 07_KillQueryMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
80
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
}
}
TEST_F
(
D
ndTestProfile
,
08
_KillQueryMsg_InvalidConn
)
{
int32_t
contLen
=
sizeof
(
SKillQuery
Msg
);
TEST_F
(
M
ndTestProfile
,
08
_KillQueryMsg_InvalidConn
)
{
int32_t
contLen
=
sizeof
(
SKillQuery
Req
);
SKillQuery
Msg
*
pReq
=
(
SKillQueryMsg
*
)
rpcMallocCont
(
contLen
);
SKillQuery
Req
*
pReq
=
(
SKillQueryReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
connId
=
htonl
(
2345
);
pReq
->
queryId
=
htonl
(
1234
);
...
...
@@ -266,7 +266,7 @@ TEST_F(DndTestProfile, 08_KillQueryMsg_InvalidConn) {
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_INVALID_CONN_ID
);
}
TEST_F
(
D
ndTestProfile
,
09
_KillQueryMsg
)
{
TEST_F
(
M
ndTestProfile
,
09
_KillQueryMsg
)
{
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_QUERIES
,
""
);
CHECK_META
(
"show queries"
,
14
);
...
...
source/dnode/mnode/impl/test/show/show.cpp
浏览文件 @
d10df1e3
...
...
@@ -13,7 +13,7 @@
class
MndTestShow
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/mnode_test_show"
,
902
0
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/mnode_test_show"
,
902
1
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
@@ -50,9 +50,9 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) {
}
TEST_F
(
MndTestShow
,
03
_ShowMsg_Conn
)
{
int32_t
contLen
=
sizeof
(
SConnect
Msg
);
int32_t
contLen
=
sizeof
(
SConnect
Req
);
SConnect
Msg
*
pReq
=
(
SConnectMsg
*
)
rpcMallocCont
(
contLen
);
SConnect
Req
*
pReq
=
(
SConnectReq
*
)
rpcMallocCont
(
contLen
);
pReq
->
pid
=
htonl
(
1234
);
strcpy
(
pReq
->
app
,
"mnode_test_show"
);
strcpy
(
pReq
->
db
,
""
);
...
...
src/client/src/tscProfile.c
浏览文件 @
d10df1e3
...
...
@@ -226,7 +226,7 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
}
int
tscBuildQueryStreamDesc
(
void
*
pMsg
,
STscObj
*
pObj
)
{
SHeartBeat
Msg
*
pHeartbeat
=
pMsg
;
SHeartBeat
Req
*
pHeartbeat
=
pMsg
;
int
allocedQueriesNum
=
pHeartbeat
->
numOfQueries
;
int
allocedStreamsNum
=
pHeartbeat
->
numOfStreams
;
...
...
@@ -327,7 +327,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
}
int32_t
msgLen
=
pHeartbeat
->
numOfQueries
*
sizeof
(
SQueryDesc
)
+
pHeartbeat
->
numOfStreams
*
sizeof
(
SStreamDesc
)
+
sizeof
(
SHeartBeat
Msg
);
sizeof
(
SHeartBeat
Req
);
pHeartbeat
->
connId
=
htonl
(
pObj
->
connId
);
pHeartbeat
->
numOfQueries
=
htonl
(
pHeartbeat
->
numOfQueries
);
pHeartbeat
->
numOfStreams
=
htonl
(
pHeartbeat
->
numOfStreams
);
...
...
src/client/src/tscServer.c
浏览文件 @
d10df1e3
...
...
@@ -1469,7 +1469,7 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildKillMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SKillQuery
Msg
);
pCmd
->
payloadLen
=
sizeof
(
SKillQuery
Req
);
switch
(
pCmd
->
command
)
{
case
TSDB_SQL_KILL_QUERY
:
...
...
@@ -1862,14 +1862,14 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STscObj
*
pObj
=
pSql
->
pTscObj
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
msgType
=
TDMT_MND_CONNECT
;
pCmd
->
payloadLen
=
sizeof
(
SConnect
Msg
);
pCmd
->
payloadLen
=
sizeof
(
SConnect
Req
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"0x%"
PRIx64
" failed to malloc for query msg"
,
pSql
->
self
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
SConnect
Msg
*
pConnect
=
(
SConnectMsg
*
)
pCmd
->
payload
;
SConnect
Req
*
pConnect
=
(
SConnectReq
*
)
pCmd
->
payload
;
// TODO refactor full_name
char
*
db
;
// ugly code to move the space
...
...
@@ -1974,7 +1974,7 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
numOfStreams
++
;
}
int
size
=
numOfQueries
*
sizeof
(
SQueryDesc
)
+
numOfStreams
*
sizeof
(
SStreamDesc
)
+
sizeof
(
SHeartBeat
Msg
)
+
100
;
int
size
=
numOfQueries
*
sizeof
(
SQueryDesc
)
+
numOfStreams
*
sizeof
(
SStreamDesc
)
+
sizeof
(
SHeartBeat
Req
)
+
100
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
pthread_mutex_unlock
(
&
pObj
->
mutex
);
tscError
(
"0x%"
PRIx64
" failed to create heartbeat msg"
,
pSql
->
self
);
...
...
@@ -1982,7 +1982,7 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
// TODO the expired hb and client can not be identified by server till now.
SHeartBeat
Msg
*
pHeartbeat
=
(
SHeartBeatMsg
*
)
pCmd
->
payload
;
SHeartBeat
Req
*
pHeartbeat
=
(
SHeartBeatReq
*
)
pCmd
->
payload
;
tstrncpy
(
pHeartbeat
->
clientVer
,
version
,
tListLen
(
pHeartbeat
->
clientVer
));
pHeartbeat
->
numOfQueries
=
numOfQueries
;
...
...
tests/script/general/table/basic1.sim
浏览文件 @
d10df1e3
...
...
@@ -44,13 +44,20 @@ print $data10 $data11 $data12
print =============== create child table
sql create table c1 using st tags(1)
sql create table c2 using st tags(2)
sql create table c2 using st tags(2)
sql show tables
if $rows != 2 then
return -1
endi
sql create table c3 using st tags(3) c4 using st tags(4) c5 using st tags(5) c6 using st tags(6) c7 using st tags(7)
sql show tables
if $rows != 7 then
return -1
endi
print $data00 $data01 $data02
print $data10 $data11 $data22
print $data20 $data11 $data22
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录