Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
78031df2
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看板
提交
78031df2
编写于
3月 31, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-16]
上级
5ab9f981
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
185 addition
and
7 deletion
+185
-7
src/client/src/tscServer.c
src/client/src/tscServer.c
+19
-2
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+3
-2
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+6
-3
tests/script/sh/exec_up.sh
tests/script/sh/exec_up.sh
+109
-0
tests/script/unique/account/basic.sim
tests/script/unique/account/basic.sim
+45
-0
tests/script/unique/testSuite.sim
tests/script/unique/testSuite.sim
+3
-0
未找到文件。
src/client/src/tscServer.c
浏览文件 @
78031df2
...
...
@@ -1065,7 +1065,7 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
tscBuildDrop
Acct
Msg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildDrop
User
Msg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SCMDropUserMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_USER
;
...
...
@@ -1082,6 +1082,23 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
tscBuildDropAcctMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SCMDropUserMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_ACCT
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_CLI_OUT_OF_MEMORY
;
}
SCMDropUserMsg
*
pDropMsg
=
(
SCMDropUserMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
strcpy
(
pDropMsg
->
user
,
pTableMetaInfo
->
name
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
tscBuildUseDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SCMUseDbMsg
);
...
...
@@ -2550,7 +2567,7 @@ void tscInitMsgsFp() {
tscBuildMsg
[
TSDB_SQL_ALTER_ACCT
]
=
tscBuildAcctMsg
;
tscBuildMsg
[
TSDB_SQL_CREATE_TABLE
]
=
tscBuildCreateTableMsg
;
tscBuildMsg
[
TSDB_SQL_DROP_USER
]
=
tscBuildDrop
Acct
Msg
;
tscBuildMsg
[
TSDB_SQL_DROP_USER
]
=
tscBuildDrop
User
Msg
;
tscBuildMsg
[
TSDB_SQL_DROP_ACCT
]
=
tscBuildDropAcctMsg
;
tscBuildMsg
[
TSDB_SQL_DROP_DB
]
=
tscBuildDropDbMsg
;
tscBuildMsg
[
TSDB_SQL_DROP_TABLE
]
=
tscBuildDropTableMsg
;
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
78031df2
...
...
@@ -903,9 +903,10 @@ static void mgmtProcessDropDbMsg(SQueuedMsg *pMsg) {
void
mgmtDropAllDbs
(
SAcctObj
*
pAcct
)
{
int32_t
numOfDbs
=
0
;
SDbObj
*
pDb
=
NULL
;
void
*
pNode
=
NULL
;
while
(
1
)
{
void
*
pNode
=
sdbFetchRow
(
tsDbSdb
,
pNode
,
(
void
**
)
&
pDb
);
pNode
=
sdbFetchRow
(
tsDbSdb
,
pNode
,
(
void
**
)
&
pDb
);
if
(
pDb
==
NULL
)
break
;
if
(
pDb
->
pAcct
==
pAcct
)
{
...
...
@@ -914,5 +915,5 @@ void mgmtDropAllDbs(SAcctObj *pAcct) {
}
}
mTrace
(
"acct:%s, all dbs is is set dirty"
,
pAcct
->
acctId
,
numOfDbs
);
mTrace
(
"acct:%s, all dbs is is set dirty"
,
pAcct
->
user
,
numOfDbs
);
}
\ No newline at end of file
src/mnode/src/mgmtUser.c
浏览文件 @
78031df2
...
...
@@ -61,7 +61,9 @@ static int32_t mgmtUserActionDelete(SSdbOperDesc *pOper) {
SUserObj
*
pUser
=
pOper
->
pObj
;
SAcctObj
*
pAcct
=
acctGetAcct
(
pUser
->
acct
);
acctRemoveUser
(
pAcct
,
pUser
);
if
(
pAcct
!=
NULL
)
{
acctRemoveUser
(
pAcct
,
pUser
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -448,7 +450,8 @@ static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg) {
return
;
}
if
(
strcmp
(
pUser
->
user
,
"monitor"
)
==
0
||
(
strcmp
(
pUser
->
user
+
1
,
pUser
->
acct
)
==
0
&&
pUser
->
user
[
0
]
==
'_'
))
{
if
(
strcmp
(
pUser
->
user
,
"monitor"
)
==
0
||
strcmp
(
pUser
->
user
,
pUser
->
acct
)
==
0
||
(
strcmp
(
pUser
->
user
+
1
,
pUser
->
acct
)
==
0
&&
pUser
->
user
[
0
]
==
'_'
))
{
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_NO_RIGHTS
);
return
;
}
...
...
@@ -507,5 +510,5 @@ void mgmtDropAllUsers(SAcctObj *pAcct) {
}
}
mTrace
(
"acct:%s, all users
is dropped from sdb"
,
pAcct
->
acctId
,
numOfUsers
);
mTrace
(
"acct:%s, all users
:%d is dropped from sdb"
,
pAcct
->
user
,
numOfUsers
);
}
\ No newline at end of file
tests/script/sh/exec_up.sh
0 → 100755
浏览文件 @
78031df2
#!/bin/sh
# if [ $# != 4 || $# != 5 ]; then
# echo "argument list need input : "
# echo " -n nodeName"
# echo " -s start/stop"
# echo " -c clear"
# exit 1
# fi
NODE_NAME
=
EXEC_OPTON
=
CLEAR_OPTION
=
"false"
while
getopts
"n:s:u:x:ct"
arg
do
case
$arg
in
n
)
NODE_NAME
=
$OPTARG
;;
s
)
EXEC_OPTON
=
$OPTARG
;;
c
)
CLEAR_OPTION
=
"clear"
;;
t
)
SHELL_OPTION
=
"true"
;;
u
)
USERS
=
$OPTARG
;;
x
)
SIGNAL
=
$OPTARG
;;
?
)
echo
"unkown argument"
;;
esac
done
SCRIPT_DIR
=
`
dirname
$0
`
cd
$SCRIPT_DIR
/../
SCRIPT_DIR
=
`
pwd
`
cd
../../
TAOS_DIR
=
`
pwd
`
BUILD_DIR
=
$TAOS_DIR
/../debug/build
SIM_DIR
=
$TAOS_DIR
/sim
NODE_DIR
=
$SIM_DIR
/
$NODE_NAME
EXE_DIR
=
$BUILD_DIR
/bin
CFG_DIR
=
$NODE_DIR
/cfg
LOG_DIR
=
$NODE_DIR
/log
DATA_DIR
=
$NODE_DIR
/data
MGMT_DIR
=
$NODE_DIR
/data/mgmt
TSDB_DIR
=
$NODE_DIR
/data/tsdb
TAOS_CFG
=
$NODE_DIR
/cfg/taos.cfg
echo
------------
$EXEC_OPTON
$NODE_NAME
TAOS_FLAG
=
$SIM_DIR
/tsim/flag
if
[
-f
"
$TAOS_FLAG
"
]
;
then
EXE_DIR
=
/usr/local/bin/taos
fi
if
[
"
$CLEAR_OPTION
"
=
"clear"
]
;
then
echo rm
-rf
$MGMT_DIR
$TSDB_DIR
rm
-rf
$TSDB_DIR
rm
-rf
$MGMT_DIR
fi
if
[
"
$SHELL_OPTION
"
=
"true"
]
;
then
if
[
"
$EXEC_OPTON
"
=
"start"
]
;
then
echo
"ExcuteCmd:"
$EXE_DIR
/taos
-c
$CFG_DIR
-u
$USERS
-p
$EXE_DIR
/taos
-c
$CFG_DIR
-u
$USERS
-p
else
#relative path
RCFG_DIR
=
sim/
$NODE_NAME
/cfg
PID
=
`
ps
-ef
|grep
-v
taosd |
grep
taos |
grep
$RCFG_DIR
|
grep
-v
grep
|
awk
'{print $2}'
`
if
[
-n
"
$PID
"
]
;
then
sudo kill
-9
$PID
fi
fi
return
fi
if
[
"
$EXEC_OPTON
"
=
"start"
]
;
then
echo
"ExcuteCmd:"
$EXE_DIR
/taosd
-c
$CFG_DIR
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
#TT=`date +%s`
#mkdir ${LOG_DIR}/${TT}
#echo valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR
#nohup valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &
else
#relative path
RCFG_DIR
=
sim/
$NODE_NAME
/cfg
PID
=
`
ps
-ef
|grep taosd |
grep
$RCFG_DIR
|
grep
-v
grep
|
awk
'{print $2}'
`
if
[
-n
"
$PID
"
]
;
then
if
[
"
$SIGNAL
"
=
"SIGINT"
]
;
then
echo
killed by signal
sudo kill
-sigint
$PID
else
sudo kill
-9
$PID
fi
fi
fi
tests/script/unique/account/basic.sim
0 → 100644
浏览文件 @
78031df2
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/exec_up.sh -n dnode1 -s start
sql connect
print =============== show accounts
sql show accounts
if $rows != 1 then
return -1
endi
print $data00 $data01 $data02
print =============== create account1
sql create account account1 PASS 'account1'
sql show accounts
if $rows != 2 then
return -1
endi
print $data00 $data01 $data02
print $data10 $data11 $data22
print =============== create account2
sql create account account2 PASS 'account2'
sql show accounts
if $rows != 3 then
return -1
endi
print $data00 $data01 $data02
print $data10 $data11 $data22
print $data20 $data11 $data22
print =============== drop account1
sql drop account account1
sql show accounts
if $rows != 2 then
return -1
endi
print $data00 $data01 $data02
print $data10 $data11 $data22
tests/script/unique/testSuite.sim
0 → 100644
浏览文件 @
78031df2
#################################
run unique/account/basic.sim
##################################
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录