Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
40122d3c
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看板
提交
40122d3c
编写于
12月 21, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 test for profile
上级
26a3ff9b
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
398 addition
and
916 deletion
+398
-916
include/common/taosmsg.h
include/common/taosmsg.h
+1
-14
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+0
-1
source/dnode/mgmt/impl/test/CMakeLists.txt
source/dnode/mgmt/impl/test/CMakeLists.txt
+2
-4
source/dnode/mgmt/impl/test/profile/CMakeLists.txt
source/dnode/mgmt/impl/test/profile/CMakeLists.txt
+6
-6
source/dnode/mgmt/impl/test/profile/profile.cpp
source/dnode/mgmt/impl/test/profile/profile.cpp
+199
-444
source/dnode/mgmt/impl/test/show/show.cpp
source/dnode/mgmt/impl/test/show/show.cpp
+143
-165
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+40
-273
tests/script/general/user/basic1.sim
tests/script/general/user/basic1.sim
+2
-2
tests/script/general/user/pass_len.sim
tests/script/general/user/pass_len.sim
+5
-7
未找到文件。
include/common/taosmsg.h
浏览文件 @
40122d3c
...
@@ -78,8 +78,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CREATE_STB, "create-stb" )
...
@@ -78,8 +78,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CREATE_STB, "create-stb" )
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_ALTER_STB
,
"alter-stb"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_ALTER_STB
,
"alter-stb"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_DROP_STB
,
"drop-stb"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_DROP_STB
,
"drop-stb"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_VGROUP_LIST
,
"vgroup-list"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_VGROUP_LIST
,
"vgroup-list"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_KILL_QUERY
,
"kill-query"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_KILL_QUERY
,
"kill-query"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_KILL_STREAM
,
"kill-stream"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_KILL_CONN
,
"kill-conn"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_KILL_CONN
,
"kill-conn"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_HEARTBEAT
,
"heartbeat"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_HEARTBEAT
,
"heartbeat"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_SHOW
,
"show"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_SHOW
,
"show"
)
...
@@ -946,18 +945,6 @@ typedef struct {
...
@@ -946,18 +945,6 @@ typedef struct {
char
subSqlInfo
[
TSDB_SHOW_SUBQUERY_LEN
];
// include subqueries' index, Obj IDs and states(C-complete/I-imcomplete)
char
subSqlInfo
[
TSDB_SHOW_SUBQUERY_LEN
];
// include subqueries' index, Obj IDs and states(C-complete/I-imcomplete)
}
SQueryDesc
;
}
SQueryDesc
;
typedef
struct
{
char
sql
[
TSDB_SHOW_SQL_LEN
];
char
dstTable
[
TSDB_TABLE_NAME_LEN
];
int32_t
streamId
;
int64_t
num
;
// number of computing/cycles
int64_t
useconds
;
int64_t
ctime
;
int64_t
stime
;
int64_t
slidingTime
;
int64_t
interval
;
}
SStreamDesc
;
typedef
struct
{
typedef
struct
{
int32_t
connId
;
int32_t
connId
;
int32_t
pid
;
int32_t
pid
;
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
40122d3c
...
@@ -73,7 +73,6 @@ static void dndInitMsgFp(STransMgmt *pMgmt) {
...
@@ -73,7 +73,6 @@ static void dndInitMsgFp(STransMgmt *pMgmt) {
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_DROP_STB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_DROP_STB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_VGROUP_LIST
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_VGROUP_LIST
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_KILL_QUERY
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_KILL_QUERY
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_KILL_STREAM
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_KILL_CONN
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_KILL_CONN
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_HEARTBEAT
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_HEARTBEAT
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_SHOW
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
TSDB_MSG_TYPE_SHOW
]
=
dndProcessMnodeReadMsg
;
...
...
source/dnode/mgmt/impl/test/CMakeLists.txt
浏览文件 @
40122d3c
...
@@ -8,13 +8,11 @@ add_subdirectory(db)
...
@@ -8,13 +8,11 @@ add_subdirectory(db)
add_subdirectory
(
dnode
)
add_subdirectory
(
dnode
)
# add_subdirectory(func)
# add_subdirectory(func)
# add_subdirectory(mnode)
# add_subdirectory(mnode)
#
add_subdirectory(profile)
add_subdirectory
(
profile
)
#
add_subdirectory(show)
add_subdirectory
(
show
)
add_subdirectory
(
stb
)
add_subdirectory
(
stb
)
# add_subdirectory(sync)
# add_subdirectory(sync)
# add_subdirectory(telem)
# add_subdirectory(telem)
# add_subdirectory(trans)
# add_subdirectory(trans)
add_subdirectory
(
user
)
add_subdirectory
(
user
)
add_subdirectory
(
vgroup
)
add_subdirectory
(
vgroup
)
# add_subdirectory(common)
source/dnode/mgmt/impl/test/profile/CMakeLists.txt
浏览文件 @
40122d3c
add_executable
(
dn
dTestP
rofile
""
)
add_executable
(
dn
ode_test_p
rofile
""
)
target_sources
(
dn
dTestP
rofile
target_sources
(
dn
ode_test_p
rofile
PRIVATE
PRIVATE
"profile.cpp"
"profile.cpp"
"../sut/deploy.cpp"
"../sut/deploy.cpp"
)
)
target_link_libraries
(
target_link_libraries
(
dn
dTestP
rofile
dn
ode_test_p
rofile
PUBLIC dnode
PUBLIC dnode
PUBLIC util
PUBLIC util
PUBLIC os
PUBLIC os
PUBLIC gtest_main
PUBLIC gtest_main
)
)
target_include_directories
(
dn
dTestP
rofile
target_include_directories
(
dn
ode_test_p
rofile
PUBLIC
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
...
@@ -22,6 +22,6 @@ target_include_directories(dndTestProfile
...
@@ -22,6 +22,6 @@ target_include_directories(dndTestProfile
)
)
add_test
(
add_test
(
NAME dn
dTestP
rofile
NAME dn
ode_test_p
rofile
COMMAND dn
dTestP
rofile
COMMAND dn
ode_test_p
rofile
)
)
source/dnode/mgmt/impl/test/profile/profile.cpp
浏览文件 @
40122d3c
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/test/show/show.cpp
浏览文件 @
40122d3c
...
@@ -13,61 +13,169 @@
...
@@ -13,61 +13,169 @@
class
DndTestShow
:
public
::
testing
::
Test
{
class
DndTestShow
:
public
::
testing
::
Test
{
protected:
protected:
void
SetUp
()
override
{}
static
SServer
*
CreateServer
(
const
char
*
path
,
const
char
*
fqdn
,
uint16_t
port
,
const
char
*
firstEp
)
{
void
TearDown
()
override
{}
SServer
*
pServer
=
createServer
(
path
,
fqdn
,
port
,
firstEp
);
ASSERT
(
pServer
);
return
pServer
;
}
static
void
SetUpTestSuite
()
{
static
void
SetUpTestSuite
()
{
const
char
*
user
=
"root"
;
initLog
(
"/tmp/tdlog"
);
const
char
*
pass
=
"taosdata"
;
const
char
*
path
=
"/tmp/dndTestShow"
;
const
char
*
fqdn
=
"localhost"
;
uint16_t
port
=
9523
;
pServer
=
createServer
(
path
,
fqdn
,
port
);
const
char
*
fqdn
=
"localhost"
;
ASSERT
(
pServer
);
const
char
*
firstEp
=
"localhost:9091"
;
pClient
=
createClient
(
user
,
pass
,
fqdn
,
port
);
pServer
=
CreateServer
(
"/tmp/dnode_test_show"
,
fqdn
,
9091
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9091
);
taosMsleep
(
300
);
}
}
static
void
TearDownTestSuite
()
{
static
void
TearDownTestSuite
()
{
stopServer
(
pServer
);
stopServer
(
pServer
);
dropClient
(
pClient
);
dropClient
(
pClient
);
pServer
=
NULL
;
pClient
=
NULL
;
}
}
static
SServer
*
pServer
;
static
SServer
*
pServer
;
static
SClient
*
pClient
;
static
SClient
*
pClient
;
static
int32_t
connId
;
static
int32_t
connId
;
};
SServer
*
DndTestShow
::
pServer
;
public:
SClient
*
DndTestShow
::
pClient
;
void
SetUp
()
override
{}
int32_t
DndTestShow
::
connId
;
void
TearDown
()
override
{}
TEST_F
(
DndTestShow
,
SShowMsg_01
)
{
void
SendTheCheckShowMetaMsg
(
int8_t
showType
,
const
char
*
showName
,
int32_t
columns
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SShowMsg
*
pShow
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
pShow
->
type
=
showType
;
strcpy
(
pShow
->
db
,
""
);
SRpcMsg
showRpcMsg
=
{
0
};
showRpcMsg
.
pCont
=
pShow
;
showRpcMsg
.
contLen
=
sizeof
(
SShowMsg
);
showRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW
;
sendMsg
(
pClient
,
&
showRpcMsg
);
ASSERT_NE
(
pClient
->
pRsp
,
nullptr
);
ASSERT_EQ
(
pClient
->
pRsp
->
code
,
0
);
ASSERT_NE
(
pClient
->
pRsp
->
pCont
,
nullptr
);
SShowRsp
*
pShowRsp
=
(
SShowRsp
*
)
pClient
->
pRsp
->
pCont
;
ASSERT_NE
(
pShowRsp
,
nullptr
);
pShowRsp
->
showId
=
htonl
(
pShowRsp
->
showId
);
pMeta
=
&
pShowRsp
->
tableMeta
;
pMeta
->
numOfTags
=
htonl
(
pMeta
->
numOfTags
);
pMeta
->
numOfColumns
=
htonl
(
pMeta
->
numOfColumns
);
pMeta
->
sversion
=
htonl
(
pMeta
->
sversion
);
pMeta
->
tversion
=
htonl
(
pMeta
->
tversion
);
pMeta
->
tuid
=
htobe64
(
pMeta
->
tuid
);
pMeta
->
suid
=
htobe64
(
pMeta
->
suid
);
SConnectMsg
*
pReq
=
(
SConnectMsg
*
)
rpcMallocCont
(
sizeof
(
SConnectMsg
));
showId
=
pShowRsp
->
showId
;
pReq
->
pid
=
htonl
(
1234
);
strcpy
(
pReq
->
app
,
"dndTestShow"
);
strcpy
(
pReq
->
db
,
""
);
SRpcMsg
rpcMsg
=
{
0
};
EXPECT_NE
(
pShowRsp
->
showId
,
0
);
rpcMsg
.
pCont
=
pReq
;
EXPECT_STREQ
(
pMeta
->
tbFname
,
showName
);
rpcMsg
.
contLen
=
sizeof
(
SConnectMsg
);
EXPECT_EQ
(
pMeta
->
numOfTags
,
0
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CONNECT
;
EXPECT_EQ
(
pMeta
->
numOfColumns
,
columns
);
EXPECT_EQ
(
pMeta
->
precision
,
0
);
EXPECT_EQ
(
pMeta
->
tableType
,
0
);
EXPECT_EQ
(
pMeta
->
update
,
0
);
EXPECT_EQ
(
pMeta
->
sversion
,
0
);
EXPECT_EQ
(
pMeta
->
tversion
,
0
);
EXPECT_EQ
(
pMeta
->
tuid
,
0
);
EXPECT_EQ
(
pMeta
->
suid
,
0
);
}
sendMsg
(
pClient
,
&
rpcMsg
);
void
CheckSchema
(
int32_t
index
,
int8_t
type
,
int32_t
bytes
,
const
char
*
name
)
{
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
index
];
ASSERT_NE
(
pMsg
,
nullptr
);
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
type
);
EXPECT_EQ
(
pSchema
->
bytes
,
bytes
);
EXPECT_STREQ
(
pSchema
->
name
,
name
);
}
SConnectRsp
*
pRsp
=
(
SConnectRsp
*
)
pMsg
->
pCont
;
void
SendThenCheckShowRetrieveMsg
(
int32_t
rows
)
{
ASSERT_NE
(
pRsp
,
nullptr
);
SRetrieveTableMsg
*
pRetrieve
=
(
SRetrieveTableMsg
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableMsg
));
pRsp
->
connId
=
htonl
(
pRsp
->
connId
);
pRetrieve
->
showId
=
htonl
(
showId
);
pRetrieve
->
free
=
0
;
SRpcMsg
retrieveRpcMsg
=
{
0
};
retrieveRpcMsg
.
pCont
=
pRetrieve
;
retrieveRpcMsg
.
contLen
=
sizeof
(
SRetrieveTableMsg
);
retrieveRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW_RETRIEVE
;
sendMsg
(
pClient
,
&
retrieveRpcMsg
);
ASSERT_NE
(
pClient
->
pRsp
,
nullptr
);
ASSERT_EQ
(
pClient
->
pRsp
->
code
,
0
);
ASSERT_NE
(
pClient
->
pRsp
->
pCont
,
nullptr
);
pRetrieveRsp
=
(
SRetrieveTableRsp
*
)
pClient
->
pRsp
->
pCont
;
ASSERT_NE
(
pRetrieveRsp
,
nullptr
);
pRetrieveRsp
->
numOfRows
=
htonl
(
pRetrieveRsp
->
numOfRows
);
pRetrieveRsp
->
useconds
=
htobe64
(
pRetrieveRsp
->
useconds
);
pRetrieveRsp
->
compLen
=
htonl
(
pRetrieveRsp
->
compLen
);
EXPECT_EQ
(
pRetrieveRsp
->
numOfRows
,
rows
);
EXPECT_EQ
(
pRetrieveRsp
->
useconds
,
0
);
// EXPECT_EQ(pRetrieveRsp->completed, completed);
EXPECT_EQ
(
pRetrieveRsp
->
precision
,
TSDB_TIME_PRECISION_MILLI
);
EXPECT_EQ
(
pRetrieveRsp
->
compressed
,
0
);
EXPECT_EQ
(
pRetrieveRsp
->
compLen
,
0
);
pData
=
pRetrieveRsp
->
data
;
pos
=
0
;
}
EXPECT_EQ
(
pRsp
->
connId
,
1
);
void
CheckInt16
(
int16_t
val
)
{
connId
=
pRsp
->
connId
;
int16_t
data
=
*
((
int16_t
*
)(
pData
+
pos
));
}
pos
+=
sizeof
(
int16_t
);
EXPECT_EQ
(
data
,
val
);
}
void
CheckInt32
(
int32_t
val
)
{
int32_t
data
=
*
((
int32_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int32_t
);
EXPECT_EQ
(
data
,
val
);
}
void
CheckInt64
(
int64_t
val
)
{
int64_t
data
=
*
((
int64_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int64_t
);
EXPECT_EQ
(
data
,
val
);
}
void
CheckTimestamp
()
{
int64_t
data
=
*
((
int64_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int64_t
);
EXPECT_GT
(
data
,
0
);
}
void
CheckBinary
(
const
char
*
val
,
int32_t
len
)
{
pos
+=
sizeof
(
VarDataLenT
);
char
*
data
=
(
char
*
)(
pData
+
pos
);
pos
+=
len
;
EXPECT_STREQ
(
data
,
val
);
}
void
IgnoreBinary
(
int32_t
len
)
{
pos
+=
sizeof
(
VarDataLenT
);
char
*
data
=
(
char
*
)(
pData
+
pos
);
pos
+=
len
;
}
int32_t
showId
;
STableMetaMsg
*
pMeta
;
SRetrieveTableRsp
*
pRetrieveRsp
;
char
*
pData
;
int32_t
pos
;
};
TEST_F
(
DndTestShow
,
SShowMsg_02
)
{
SServer
*
DndTestShow
::
pServer
;
SClient
*
DndTestShow
::
pClient
;
int32_t
DndTestShow
::
connId
;
TEST_F
(
DndTestShow
,
01
_ShowMsg_InvalidMsgMax
)
{
ASSERT_NE
(
pClient
,
nullptr
);
ASSERT_NE
(
pClient
,
nullptr
);
SShowMsg
*
pReq
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
SShowMsg
*
pReq
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
...
@@ -85,7 +193,7 @@ TEST_F(DndTestShow, SShowMsg_02) {
...
@@ -85,7 +193,7 @@ TEST_F(DndTestShow, SShowMsg_02) {
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_INVALID_MSG_TYPE
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_INVALID_MSG_TYPE
);
}
}
TEST_F
(
DndTestShow
,
SShowMsg_03
)
{
TEST_F
(
DndTestShow
,
02
_ShowMsg_InvalidMsgStart
)
{
ASSERT_NE
(
pClient
,
nullptr
);
ASSERT_NE
(
pClient
,
nullptr
);
SShowMsg
*
pReq
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
SShowMsg
*
pReq
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
...
@@ -102,133 +210,3 @@ TEST_F(DndTestShow, SShowMsg_03) {
...
@@ -102,133 +210,3 @@ TEST_F(DndTestShow, SShowMsg_03) {
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_INVALID_MSG_TYPE
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_INVALID_MSG_TYPE
);
}
}
TEST_F
(
DndTestShow
,
SShowMsg_04
)
{
ASSERT_NE
(
pClient
,
nullptr
);
int32_t
showId
=
0
;
{
SShowMsg
*
pReq
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
pReq
->
type
=
TSDB_MGMT_TABLE_CONNS
;
strcpy
(
pReq
->
db
,
""
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SShowMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
SShowRsp
*
pRsp
=
(
SShowRsp
*
)
pMsg
->
pCont
;
ASSERT_NE
(
pRsp
,
nullptr
);
pRsp
->
showId
=
htonl
(
pRsp
->
showId
);
STableMetaMsg
*
pMeta
=
&
pRsp
->
tableMeta
;
pMeta
->
contLen
=
htonl
(
pMeta
->
contLen
);
pMeta
->
numOfColumns
=
htons
(
pMeta
->
numOfColumns
);
pMeta
->
sversion
=
htons
(
pMeta
->
sversion
);
pMeta
->
tversion
=
htons
(
pMeta
->
tversion
);
pMeta
->
tid
=
htonl
(
pMeta
->
tid
);
pMeta
->
uid
=
htobe64
(
pMeta
->
uid
);
pMeta
->
suid
=
htobe64
(
pMeta
->
suid
);
showId
=
pRsp
->
showId
;
EXPECT_NE
(
pRsp
->
showId
,
0
);
EXPECT_EQ
(
pMeta
->
contLen
,
0
);
EXPECT_STREQ
(
pMeta
->
tbFname
,
""
);
EXPECT_EQ
(
pMeta
->
numOfTags
,
0
);
EXPECT_EQ
(
pMeta
->
precision
,
0
);
EXPECT_EQ
(
pMeta
->
tableType
,
0
);
EXPECT_EQ
(
pMeta
->
numOfColumns
,
7
);
EXPECT_EQ
(
pMeta
->
sversion
,
0
);
EXPECT_EQ
(
pMeta
->
tversion
,
0
);
EXPECT_EQ
(
pMeta
->
tid
,
0
);
EXPECT_EQ
(
pMeta
->
uid
,
0
);
EXPECT_STREQ
(
pMeta
->
sTableName
,
""
);
EXPECT_EQ
(
pMeta
->
suid
,
0
);
SSchema
*
pSchema
=
NULL
;
pSchema
=
&
pMeta
->
pSchema
[
0
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"connId"
);
pSchema
=
&
pMeta
->
pSchema
[
1
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"user"
);
pSchema
=
&
pMeta
->
pSchema
[
2
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"program"
);
pSchema
=
&
pMeta
->
pSchema
[
3
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"pid"
);
pSchema
=
&
pMeta
->
pSchema
[
4
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"ip:port"
);
pSchema
=
&
pMeta
->
pSchema
[
5
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_TIMESTAMP
);
EXPECT_EQ
(
pSchema
->
bytes
,
8
);
EXPECT_STREQ
(
pSchema
->
name
,
"login_time"
);
pSchema
=
&
pMeta
->
pSchema
[
6
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_TIMESTAMP
);
EXPECT_EQ
(
pSchema
->
bytes
,
8
);
EXPECT_STREQ
(
pSchema
->
name
,
"last_access"
);
}
{
SRetrieveTableMsg
*
pReq
=
(
SRetrieveTableMsg
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableMsg
));
pReq
->
showId
=
htonl
(
showId
);
pReq
->
free
=
0
;
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SRetrieveTableMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW_RETRIEVE
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
SRetrieveTableRsp
*
pRsp
=
(
SRetrieveTableRsp
*
)
pMsg
->
pCont
;
ASSERT_NE
(
pRsp
,
nullptr
);
pRsp
->
numOfRows
=
htonl
(
pRsp
->
numOfRows
);
pRsp
->
offset
=
htobe64
(
pRsp
->
offset
);
pRsp
->
useconds
=
htobe64
(
pRsp
->
useconds
);
pRsp
->
compLen
=
htonl
(
pRsp
->
compLen
);
EXPECT_EQ
(
pRsp
->
numOfRows
,
1
);
EXPECT_EQ
(
pRsp
->
offset
,
0
);
EXPECT_EQ
(
pRsp
->
useconds
,
0
);
EXPECT_EQ
(
pRsp
->
completed
,
1
);
EXPECT_EQ
(
pRsp
->
precision
,
TSDB_TIME_PRECISION_MILLI
);
EXPECT_EQ
(
pRsp
->
compressed
,
0
);
EXPECT_EQ
(
pRsp
->
reserved
,
0
);
EXPECT_EQ
(
pRsp
->
compLen
,
0
);
}
}
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
40122d3c
...
@@ -23,29 +23,25 @@
...
@@ -23,29 +23,25 @@
#define QUERY_ID_SIZE 20
#define QUERY_ID_SIZE 20
#define QUERY_OBJ_ID_SIZE 18
#define QUERY_OBJ_ID_SIZE 18
#define SUBQUERY_INFO_SIZE 6
#define SUBQUERY_INFO_SIZE 6
#define QUERY_S
TREAM_S
AVE_SIZE 20
#define QUERY_SAVE_SIZE 20
typedef
struct
{
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
int32_t
id
;
char
app
[
TSDB_APP_NAME_LEN
];
// app name that invokes taosc
char
user
[
TSDB_USER_LEN
];
int32_t
pid
;
// pid of app that invokes taosc
char
app
[
TSDB_APP_NAME_LEN
];
// app name that invokes taosc
int64_t
appStartTime
;
// app start time
int64_t
appStartTimeMs
;
// app start time
int32_t
id
;
int32_t
pid
;
// pid of app that invokes taosc
int8_t
killed
;
uint32_t
ip
;
int8_t
align
;
uint16_t
port
;
uint16_t
port
;
int8_t
killed
;
uint32_t
ip
;
int64_t
loginTimeMs
;
int64_t
stime
;
int64_t
lastAccessTimeMs
;
int64_t
lastAccess
;
int32_t
queryId
;
int32_t
queryId
;
int32_t
numOfQueries
;
int32_t
streamId
;
SQueryDesc
*
pQueries
;
int32_t
numOfQueries
;
int32_t
numOfStreams
;
SStreamDesc
*
pStreams
;
SQueryDesc
*
pQueries
;
}
SConnObj
;
}
SConnObj
;
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
char
*
user
,
uint32_t
ip
,
uint16_t
port
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
);
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
SRpcConnInfo
*
pInfo
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
);
static
void
mndFreeConn
(
SConnObj
*
pConn
);
static
void
mndFreeConn
(
SConnObj
*
pConn
);
static
SConnObj
*
mndAcquireConn
(
SMnode
*
pMnode
,
int32_t
connId
);
static
SConnObj
*
mndAcquireConn
(
SMnode
*
pMnode
,
int32_t
connId
);
static
void
mndReleaseConn
(
SMnode
*
pMnode
,
SConnObj
*
pConn
);
static
void
mndReleaseConn
(
SMnode
*
pMnode
,
SConnObj
*
pConn
);
...
@@ -54,16 +50,12 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter);
...
@@ -54,16 +50,12 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter);
static
int32_t
mndProcessHeartBeatMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessHeartBeatMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessConnectMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessConnectMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessKillQueryMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessKillQueryMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessKillStreamMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessKillConnectionMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessKillConnectionMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextQuery
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextQuery
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndGetStreamMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveStreams
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextStream
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitProfile
(
SMnode
*
pMnode
)
{
int32_t
mndInitProfile
(
SMnode
*
pMnode
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
@@ -79,7 +71,6 @@ int32_t mndInitProfile(SMnode *pMnode) {
...
@@ -79,7 +71,6 @@ int32_t mndInitProfile(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_HEARTBEAT
,
mndProcessHeartBeatMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_HEARTBEAT
,
mndProcessHeartBeatMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_CONNECT
,
mndProcessConnectMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_CONNECT
,
mndProcessConnectMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_KILL_QUERY
,
mndProcessKillQueryMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_KILL_QUERY
,
mndProcessKillQueryMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_KILL_STREAM
,
mndProcessKillStreamMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_KILL_CONN
,
mndProcessKillConnectionMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_KILL_CONN
,
mndProcessKillConnectionMsg
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndGetConnsMeta
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndGetConnsMeta
);
...
@@ -88,9 +79,6 @@ int32_t mndInitProfile(SMnode *pMnode) {
...
@@ -88,9 +79,6 @@ int32_t mndInitProfile(SMnode *pMnode) {
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndGetQueryMeta
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndGetQueryMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndRetrieveQueries
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndRetrieveQueries
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndCancelGetNextQuery
);
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
;
return
0
;
}
}
...
@@ -103,46 +91,43 @@ void mndCleanupProfile(SMnode *pMnode) {
...
@@ -103,46 +91,43 @@ void mndCleanupProfile(SMnode *pMnode) {
}
}
}
}
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
char
*
user
,
uint32_t
ip
,
uint16_t
port
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
)
{
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
SRpcConnInfo
*
pInfo
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
int32_t
connId
=
atomic_add_fetch_32
(
&
pMgmt
->
connId
,
1
);
int32_t
connId
=
atomic_add_fetch_32
(
&
pMgmt
->
connId
,
1
);
if
(
connId
==
0
)
atomic_add_fetch_32
(
&
pMgmt
->
connId
,
1
);
if
(
connId
==
0
)
atomic_add_fetch_32
(
&
pMgmt
->
connId
,
1
);
if
(
startTime
==
0
)
startTime
=
taosGetTimestampMs
();
SConnObj
connObj
=
{.
pid
=
pid
,
SConnObj
connObj
=
{.
id
=
connId
,
.
appStartTime
=
startTime
,
.
appStartTimeMs
=
startTime
,
.
id
=
connId
,
.
pid
=
pid
,
.
ip
=
pInfo
->
clientIp
,
.
port
=
pInfo
->
clientPort
,
.
killed
=
0
,
.
killed
=
0
,
.
port
=
port
,
.
loginTimeMs
=
taosGetTimestampMs
(),
.
ip
=
ip
,
.
lastAccessTimeMs
=
0
,
.
stime
=
taosGetTimestampMs
(),
.
lastAccess
=
0
,
.
queryId
=
0
,
.
queryId
=
0
,
.
streamId
=
0
,
.
numOfQueries
=
0
,
.
numOfQueries
=
0
,
.
numOfStreams
=
0
,
.
pStreams
=
NULL
,
.
pQueries
=
NULL
};
.
pQueries
=
NULL
};
connObj
.
lastAccess
=
connObj
.
stime
;
connObj
.
lastAccess
TimeMs
=
connObj
.
loginTimeMs
;
tstrncpy
(
connObj
.
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
connObj
.
user
,
pInfo
->
user
,
TSDB_USER_LEN
);
tstrncpy
(
connObj
.
app
,
app
,
TSDB_APP_NAME_LEN
);
tstrncpy
(
connObj
.
app
,
app
,
TSDB_APP_NAME_LEN
);
int32_t
keepTime
=
pMnode
->
cfg
.
shellActivityTimer
*
3
;
int32_t
keepTime
=
pMnode
->
cfg
.
shellActivityTimer
*
3
;
SConnObj
*
pConn
=
taosCachePut
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
),
&
connObj
,
sizeof
(
connObj
),
keepTime
*
1000
);
SConnObj
*
pConn
=
taosCachePut
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
),
&
connObj
,
sizeof
(
connObj
),
keepTime
*
1000
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"conn:%d, data:%p failed to put into cache since %s, user:%s"
,
connId
,
pConn
,
user
,
terrstr
());
mError
(
"conn:%d, data:%p failed to put into cache since %s, user:%s"
,
connId
,
pConn
,
pInfo
->
user
,
terrstr
());
return
NULL
;
return
NULL
;
}
else
{
}
else
{
mTrace
(
"conn:%d, data:%p created, user:%s"
,
pConn
->
id
,
pConn
,
user
);
mTrace
(
"conn:%d, data:%p created, user:%s"
,
pConn
->
id
,
pConn
,
pInfo
->
user
);
return
pConn
;
return
pConn
;
}
}
}
}
static
void
mndFreeConn
(
SConnObj
*
pConn
)
{
static
void
mndFreeConn
(
SConnObj
*
pConn
)
{
tfree
(
pConn
->
pQueries
);
tfree
(
pConn
->
pQueries
);
tfree
(
pConn
->
pStreams
);
mTrace
(
"conn:%d, data:%p destroyed"
,
pConn
->
id
,
pConn
);
mTrace
(
"conn:%d, data:%p destroyed"
,
pConn
->
id
,
pConn
);
}
}
...
@@ -156,7 +141,7 @@ static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId) {
...
@@ -156,7 +141,7 @@ static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId) {
}
}
int32_t
keepTime
=
pMnode
->
cfg
.
shellActivityTimer
*
3
;
int32_t
keepTime
=
pMnode
->
cfg
.
shellActivityTimer
*
3
;
pConn
->
lastAccess
=
keepTime
*
1000
+
(
uint64_t
)
taosGetTimestampMs
();
pConn
->
lastAccess
TimeMs
=
keepTime
*
1000
+
(
uint64_t
)
taosGetTimestampMs
();
mTrace
(
"conn:%d, data:%p acquired from cache"
,
pConn
->
id
,
pConn
);
mTrace
(
"conn:%d, data:%p acquired from cache"
,
pConn
->
id
,
pConn
);
return
pConn
;
return
pConn
;
...
@@ -219,7 +204,7 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
...
@@ -219,7 +204,7 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
}
}
SConnObj
*
pConn
=
mndCreateConn
(
pMnode
,
info
.
user
,
info
.
clientIp
,
info
.
clientPort
,
pReq
->
pid
,
pReq
->
app
,
pReq
->
startTime
);
SConnObj
*
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
pReq
->
pid
,
pReq
->
app
,
pReq
->
startTime
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pMsg
->
user
,
ip
,
terrstr
());
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pMsg
->
user
,
ip
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -254,16 +239,14 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
...
@@ -254,16 +239,14 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
static
int32_t
mndSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatMsg
*
pMsg
)
{
static
int32_t
mndSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatMsg
*
pMsg
)
{
pConn
->
numOfQueries
=
0
;
pConn
->
numOfQueries
=
0
;
pConn
->
numOfStreams
=
0
;
int32_t
numOfQueries
=
htonl
(
pMsg
->
numOfQueries
);
int32_t
numOfQueries
=
htonl
(
pMsg
->
numOfQueries
);
int32_t
numOfStreams
=
htonl
(
pMsg
->
numOfStreams
);
if
(
numOfQueries
>
0
)
{
if
(
numOfQueries
>
0
)
{
if
(
pConn
->
pQueries
==
NULL
)
{
if
(
pConn
->
pQueries
==
NULL
)
{
pConn
->
pQueries
=
calloc
(
sizeof
(
SQueryDesc
),
QUERY_S
TREAM_S
AVE_SIZE
);
pConn
->
pQueries
=
calloc
(
sizeof
(
SQueryDesc
),
QUERY_SAVE_SIZE
);
}
}
pConn
->
numOfQueries
=
MIN
(
QUERY_S
TREAM_S
AVE_SIZE
,
numOfQueries
);
pConn
->
numOfQueries
=
MIN
(
QUERY_SAVE_SIZE
,
numOfQueries
);
int32_t
saveSize
=
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
);
int32_t
saveSize
=
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
);
if
(
saveSize
>
0
&&
pConn
->
pQueries
!=
NULL
)
{
if
(
saveSize
>
0
&&
pConn
->
pQueries
!=
NULL
)
{
...
@@ -271,19 +254,6 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatMsg *pMsg) {
...
@@ -271,19 +254,6 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatMsg *pMsg) {
}
}
}
}
if
(
numOfStreams
>
0
)
{
if
(
pConn
->
pStreams
==
NULL
)
{
pConn
->
pStreams
=
calloc
(
sizeof
(
SStreamDesc
),
QUERY_STREAM_SAVE_SIZE
);
}
pConn
->
numOfStreams
=
MIN
(
QUERY_STREAM_SAVE_SIZE
,
numOfStreams
);
int32_t
saveSize
=
pConn
->
numOfStreams
*
sizeof
(
SStreamDesc
);
if
(
saveSize
>
0
&&
pConn
->
pStreams
!=
NULL
)
{
memcpy
(
pConn
->
pStreams
,
pMsg
->
pData
+
numOfQueries
*
sizeof
(
SQueryDesc
),
saveSize
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -303,7 +273,7 @@ static int32_t mndProcessHeartBeatMsg(SMnodeMsg *pMsg) {
...
@@ -303,7 +273,7 @@ static int32_t mndProcessHeartBeatMsg(SMnodeMsg *pMsg) {
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
pReq
->
connId
);
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
pReq
->
connId
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
pConn
=
mndCreateConn
(
pMnode
,
info
.
user
,
info
.
clientIp
,
info
.
clientPort
,
pReq
->
pid
,
pReq
->
app
,
0
);
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
pReq
->
pid
,
pReq
->
app
,
0
);
if
(
pConn
==
NULL
)
{
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 conn since %s"
,
pMsg
->
user
,
pReq
->
connId
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -343,11 +313,6 @@ static int32_t mndProcessHeartBeatMsg(SMnodeMsg *pMsg) {
...
@@ -343,11 +313,6 @@ static int32_t mndProcessHeartBeatMsg(SMnodeMsg *pMsg) {
pRsp
->
killConnection
=
1
;
pRsp
->
killConnection
=
1
;
}
}
if
(
pConn
->
streamId
!=
0
)
{
pRsp
->
streamId
=
htonl
(
pConn
->
streamId
);
pConn
->
streamId
=
0
;
}
if
(
pConn
->
queryId
!=
0
)
{
if
(
pConn
->
queryId
!=
0
)
{
pRsp
->
queryId
=
htonl
(
pConn
->
queryId
);
pRsp
->
queryId
=
htonl
(
pConn
->
queryId
);
pConn
->
queryId
=
0
;
pConn
->
queryId
=
0
;
...
@@ -395,37 +360,6 @@ static int32_t mndProcessKillQueryMsg(SMnodeMsg *pMsg) {
...
@@ -395,37 +360,6 @@ static int32_t mndProcessKillQueryMsg(SMnodeMsg *pMsg) {
}
}
}
}
static
int32_t
mndProcessKillStreamMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pMsg
->
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
mndReleaseUser
(
pMnode
,
pUser
);
SKillStreamMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
int32_t
connId
=
htonl
(
pKill
->
connId
);
int32_t
streamId
=
htonl
(
pKill
->
streamId
);
mDebug
(
"kill stream msg is received, streamId:%d"
,
streamId
);
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
));
if
(
pConn
==
NULL
)
{
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:%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
;
}
}
static
int32_t
mndProcessKillConnectionMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessKillConnectionMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
@@ -525,6 +459,7 @@ static int32_t mndGetConnsMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
...
@@ -525,6 +459,7 @@ static int32_t mndGetConnsMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
numOfRows
=
taosHashGetSize
(
pMgmt
->
cache
->
pHashTable
);
pShow
->
numOfRows
=
taosHashGetSize
(
pMgmt
->
cache
->
pHashTable
);
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
strcpy
(
pMeta
->
tbFname
,
mndShowStr
(
pShow
->
type
));
return
0
;
return
0
;
}
}
...
@@ -567,12 +502,12 @@ static int32_t mndRetrieveConns(SMnodeMsg *pMsg, SShowObj *pShow, char *data, in
...
@@ -567,12 +502,12 @@ static int32_t mndRetrieveConns(SMnodeMsg *pMsg, SShowObj *pShow, char *data, in
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
pConn
->
stime
;
*
(
int64_t
*
)
pWrite
=
pConn
->
loginTimeMs
;
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
if
(
pConn
->
lastAccess
<
pConn
->
stime
)
pConn
->
lastAccess
=
pConn
->
stime
;
if
(
pConn
->
lastAccess
TimeMs
<
pConn
->
loginTimeMs
)
pConn
->
lastAccessTimeMs
=
pConn
->
loginTimeMs
;
*
(
int64_t
*
)
pWrite
=
pConn
->
lastAccess
;
*
(
int64_t
*
)
pWrite
=
pConn
->
lastAccess
TimeMs
;
cols
++
;
cols
++
;
numOfRows
++
;
numOfRows
++
;
...
@@ -623,7 +558,7 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
...
@@ -623,7 +558,7 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
2
4
;
pShow
->
bytes
[
cols
]
=
2
2
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"qid"
);
strcpy
(
pSchema
[
cols
].
name
,
"qid"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
...
@@ -693,6 +628,7 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
...
@@ -693,6 +628,7 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
numOfRows
=
1000000
;
pShow
->
numOfRows
=
1000000
;
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
strcpy
(
pMeta
->
tbFname
,
mndShowStr
(
pShow
->
type
));
return
0
;
return
0
;
}
}
...
@@ -790,6 +726,7 @@ static int32_t mndRetrieveQueries(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
...
@@ -790,6 +726,7 @@ static int32_t mndRetrieveQueries(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
}
}
}
}
mndVacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
return
numOfRows
;
}
}
...
@@ -798,173 +735,3 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter) {
...
@@ -798,173 +735,3 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter) {
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
taosHashCancelIterate
(
pMgmt
->
cache
->
pHashTable
,
pIter
);
taosHashCancelIterate
(
pMgmt
->
cache
->
pHashTable
,
pIter
);
}
}
static
int32_t
mndGetStreamMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pMsg
->
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
mndReleaseUser
(
pMnode
,
pUser
);
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"streamId"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"destination"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"exec"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
strcpy
(
pSchema
[
cols
].
name
,
"time(us)"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sql"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"cycles"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
for
(
int32_t
i
=
1
;
i
<
cols
;
++
i
)
{
pShow
->
offset
[
i
]
=
pShow
->
offset
[
i
-
1
]
+
pShow
->
bytes
[
i
-
1
];
}
pShow
->
numOfRows
=
1000000
;
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
return
0
;
}
static
int32_t
mndRetrieveStreams
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
int32_t
numOfRows
=
0
;
SConnObj
*
pConn
=
NULL
;
int32_t
cols
=
0
;
char
*
pWrite
;
void
*
pIter
;
char
ipStr
[
TSDB_IPv4ADDR_LEN
+
6
];
while
(
numOfRows
<
rows
)
{
pIter
=
mndGetNextConn
(
pMnode
,
pShow
->
pIter
,
&
pConn
);
if
(
pConn
==
NULL
)
{
pShow
->
pIter
=
pIter
;
break
;
}
if
(
numOfRows
+
pConn
->
numOfStreams
>=
rows
)
{
mndCancelGetNextConn
(
pMnode
,
pIter
);
break
;
}
pShow
->
pIter
=
pIter
;
for
(
int32_t
i
=
0
;
i
<
pConn
->
numOfStreams
;
++
i
)
{
SStreamDesc
*
pDesc
=
pConn
->
pStreams
+
i
;
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
htobe64
(
pDesc
->
streamId
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
htobe64
(
pConn
->
id
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConn
->
user
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDesc
->
dstTable
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
snprintf
(
ipStr
,
sizeof
(
ipStr
),
"%s:%u"
,
taosIpStr
(
pConn
->
ip
),
pConn
->
port
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
ipStr
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
htobe64
(
pDesc
->
ctime
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
htobe64
(
pDesc
->
stime
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
htobe64
(
pDesc
->
useconds
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDesc
->
sql
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
(
int32_t
)
htobe64
(
pDesc
->
num
);
cols
++
;
numOfRows
++
;
}
}
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
static
void
mndCancelGetNextStream
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
taosHashCancelIterate
(
pMgmt
->
cache
->
pHashTable
,
pIter
);
}
tests/script/general/user/basic1.sim
浏览文件 @
40122d3c
...
@@ -26,7 +26,7 @@ if $rows != 2 then
...
@@ -26,7 +26,7 @@ if $rows != 2 then
endi
endi
print $data00 $data01 $data02
print $data00 $data01 $data02
print $data10 $data11 $data
2
2
print $data10 $data11 $data
1
2
print $data20 $data11 $data22
print $data20 $data11 $data22
print $data30 $data31 $data32
print $data30 $data31 $data32
...
@@ -38,7 +38,7 @@ if $rows != 3 then
...
@@ -38,7 +38,7 @@ if $rows != 3 then
endi
endi
print $data00 $data01 $data02
print $data00 $data01 $data02
print $data10 $data11 $data
2
2
print $data10 $data11 $data
1
2
print $data20 $data11 $data22
print $data20 $data11 $data22
print $data30 $data31 $data32
print $data30 $data31 $data32
print $data40 $data41 $data42
print $data40 $data41 $data42
...
...
tests/script/general/user/pass_len.sim
浏览文件 @
40122d3c
...
@@ -3,8 +3,6 @@ system sh/stop_dnodes.sh
...
@@ -3,8 +3,6 @@ system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
sql connect
$i = 0
$i = 0
...
@@ -29,7 +27,7 @@ step12:
...
@@ -29,7 +27,7 @@ step12:
sql create user $user PASS 'taosdata'
sql create user $user PASS 'taosdata'
sql show users
sql show users
if $rows !=
4
then
if $rows !=
2
then
return -1
return -1
endi
endi
...
@@ -40,7 +38,7 @@ sql drop user $user -x step2
...
@@ -40,7 +38,7 @@ sql drop user $user -x step2
step2:
step2:
sql create user $user PASS '1'
sql create user $user PASS '1'
sql show users
sql show users
if $rows !=
5
then
if $rows !=
3
then
return -1
return -1
endi
endi
...
@@ -52,7 +50,7 @@ step3:
...
@@ -52,7 +50,7 @@ step3:
sql create user $user PASS 'abc0123456789'
sql create user $user PASS 'abc0123456789'
sql show users
sql show users
if $rows !=
6
then
if $rows !=
3
then
return -1
return -1
endi
endi
...
@@ -63,7 +61,7 @@ sql create user $user PASS 'abcd012345678901234567891234567890' -x step4
...
@@ -63,7 +61,7 @@ sql create user $user PASS 'abcd012345678901234567891234567890' -x step4
return -1
return -1
step4:
step4:
sql show users
sql show users
if $rows !=
6
then
if $rows !=
4
then
return -1
return -1
endi
endi
...
@@ -75,7 +73,7 @@ while $i < 3
...
@@ -75,7 +73,7 @@ while $i < 3
endw
endw
sql show users
sql show users
if $rows !=
3
then
if $rows !=
1
then
return -1
return -1
endi
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录