Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
644bfa40
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
644bfa40
编写于
4月 23, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-189] fix bug while drop user
上级
83727507
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
60 addition
and
51 deletion
+60
-51
src/mnode/src/mgmtAcct.c
src/mnode/src/mgmtAcct.c
+3
-1
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+10
-3
src/mnode/src/mgmtSdb.c
src/mnode/src/mgmtSdb.c
+10
-9
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+9
-9
tests/script/general/account/testSuite.sim
tests/script/general/account/testSuite.sim
+0
-5
tests/script/general/user/basic1.sim
tests/script/general/user/basic1.sim
+5
-0
tests/script/unique/account/account_create.sim
tests/script/unique/account/account_create.sim
+2
-3
tests/script/unique/account/account_delete.sim
tests/script/unique/account/account_delete.sim
+3
-3
tests/script/unique/account/account_len.sim
tests/script/unique/account/account_len.sim
+2
-2
tests/script/unique/account/authority.sim
tests/script/unique/account/authority.sim
+2
-2
tests/script/unique/account/basic.sim
tests/script/unique/account/basic.sim
+1
-1
tests/script/unique/account/monitor.sim
tests/script/unique/account/monitor.sim
+1
-1
tests/script/unique/account/paras.sim
tests/script/unique/account/paras.sim
+1
-1
tests/script/unique/account/pass_alter.sim
tests/script/unique/account/pass_alter.sim
+2
-2
tests/script/unique/account/pass_len.sim
tests/script/unique/account/pass_len.sim
+2
-2
tests/script/unique/account/testSuite.sim
tests/script/unique/account/testSuite.sim
+2
-2
tests/script/unique/account/usage.sim
tests/script/unique/account/usage.sim
+1
-1
tests/script/unique/account/user_create.sim
tests/script/unique/account/user_create.sim
+2
-2
tests/script/unique/account/user_len.sim
tests/script/unique/account/user_len.sim
+2
-2
未找到文件。
src/mnode/src/mgmtAcct.c
浏览文件 @
644bfa40
...
...
@@ -82,6 +82,8 @@ static int32_t mgmtActionAcctRestored() {
if
(
dnodeIsFirstDeploy
())
{
mgmtCreateRootAcct
();
}
acctInit
();
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -112,7 +114,7 @@ int32_t mgmtInitAccts() {
}
mTrace
(
"table:%s, hash is created"
,
tableDesc
.
tableName
);
return
acctInit
()
;
return
TSDB_CODE_SUCCESS
;
}
void
mgmtCleanUpAccts
()
{
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
644bfa40
...
...
@@ -882,18 +882,25 @@ static void mgmtProcessDropDbMsg(SQueuedMsg *pMsg) {
void
mgmtDropAllDbs
(
SAcctObj
*
pAcct
)
{
int32_t
numOfDbs
=
0
;
SDbObj
*
pDb
=
NULL
;
void
*
pNode
=
NULL
;
void
*
pNode
=
NULL
;
while
(
1
)
{
pNode
=
sdbFetchRow
(
tsDbSdb
,
pNode
,
(
void
**
)
&
pDb
);
if
(
pDb
==
NULL
)
break
;
if
(
pDb
->
pAcct
==
pAcct
)
{
mgmtSetDbDropping
(
pDb
);
mPrint
(
"db:%s, drop db from sdb for acct:%s is dropped"
,
pDb
->
name
,
pAcct
->
user
);
SSdbOper
oper
=
{
.
type
=
SDB_OPER_LOCAL
,
.
table
=
tsDbSdb
,
.
pObj
=
pDb
};
sdbDeleteRow
(
&
oper
);
numOfDbs
++
;
}
mgmtDecDbRef
(
pDb
);
}
mTrace
(
"acct:%s, all dbs is is
set dirty
"
,
pAcct
->
user
,
numOfDbs
);
mTrace
(
"acct:%s, all dbs is is
dropped from sdb
"
,
pAcct
->
user
,
numOfDbs
);
}
src/mnode/src/mgmtSdb.c
浏览文件 @
644bfa40
...
...
@@ -333,7 +333,7 @@ void sdbIncRef(void *handle, void *pRow) {
SSdbTable
*
pTable
=
handle
;
int32_t
*
pRefCount
=
(
int32_t
*
)(
pRow
+
pTable
->
refCountPos
);
atomic_add_fetch_32
(
pRefCount
,
1
);
if
(
0
&&
strcmp
(
pTable
->
tableName
,
"
dnode
s"
)
==
0
)
{
if
(
0
&&
strcmp
(
pTable
->
tableName
,
"
account
s"
)
==
0
)
{
sdbTrace
(
"table:%s, add ref to record:%s:%s:%d"
,
pTable
->
tableName
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pRow
),
*
pRefCount
);
}
...
...
@@ -345,7 +345,7 @@ void sdbDecRef(void *handle, void *pRow) {
SSdbTable
*
pTable
=
handle
;
int32_t
*
pRefCount
=
(
int32_t
*
)(
pRow
+
pTable
->
refCountPos
);
int32_t
refCount
=
atomic_sub_fetch_32
(
pRefCount
,
1
);
if
(
0
&&
strcmp
(
pTable
->
tableName
,
"
dnode
s"
)
==
0
)
{
if
(
0
&&
strcmp
(
pTable
->
tableName
,
"
account
s"
)
==
0
)
{
sdbTrace
(
"table:%s, def ref of record:%s:%s:%d"
,
pTable
->
tableName
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pRow
),
*
pRefCount
);
}
...
...
@@ -404,23 +404,24 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbOper *pOper) {
pthread_mutex_unlock
(
&
pTable
->
mutex
);
sdbTrace
(
"table:%s, insert record:%s to hash, numOfRows:%d
"
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pOper
->
pObj
)
,
pTable
->
numOfRows
);
sdbTrace
(
"table:%s, insert record:%s to hash, numOfRows:%d
version:%"
PRIu64
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
sdbGetVersion
()
);
(
*
pTable
->
insertFp
)(
pOper
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
sdbDeleteHash
(
SSdbTable
*
pTable
,
SSdbOper
*
pOper
)
{
(
*
pTable
->
deleteFp
)(
pOper
);
pthread_mutex_lock
(
&
pTable
->
mutex
);
(
*
sdbDeleteIndexFp
[
pTable
->
keyType
])(
pTable
->
iHandle
,
pOper
->
pObj
);
pTable
->
numOfRows
--
;
pthread_mutex_unlock
(
&
pTable
->
mutex
);
sdbTrace
(
"table:%s, delete record:%s from hash, numOfRows:%d
"
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pOper
->
pObj
)
,
pTable
->
numOfRows
);
sdbTrace
(
"table:%s, delete record:%s from hash, numOfRows:%d
version:%"
PRIu64
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
sdbGetVersion
()
);
(
*
pTable
->
deleteFp
)(
pOper
);
int8_t
*
updateEnd
=
pOper
->
pObj
+
pTable
->
refCountPos
-
1
;
*
updateEnd
=
1
;
sdbDecRef
(
pTable
,
pOper
->
pObj
);
...
...
@@ -429,8 +430,8 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
}
static
int32_t
sdbUpdateHash
(
SSdbTable
*
pTable
,
SSdbOper
*
pOper
)
{
sdbTrace
(
"table:%s, update record:%s in hash, numOfRows:%d
"
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pOper
->
pObj
)
,
pTable
->
numOfRows
);
sdbTrace
(
"table:%s, update record:%s in hash, numOfRows:%d
version:%"
PRIu64
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
sdbGetVersion
()
);
(
*
pTable
->
updateFp
)(
pOper
);
return
TSDB_CODE_SUCCESS
;
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
644bfa40
...
...
@@ -39,7 +39,7 @@ static int vnodeWalCallback(void *arg);
static
int32_t
vnodeSaveCfg
(
SMDCreateVnodeMsg
*
pVnodeCfg
);
static
int32_t
vnodeReadCfg
(
SVnodeObj
*
pVnode
);
static
int32_t
vnodeSaveVersion
(
SVnodeObj
*
pVnode
);
static
int32_t
vnodeReadVersion
(
SVnodeObj
*
pVnode
);
static
bool
vnodeReadVersion
(
SVnodeObj
*
pVnode
);
static
int
vnodeWalCallback
(
void
*
arg
);
static
uint32_t
vnodeGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
);
static
int
vnodeGetWalInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
);
...
...
@@ -287,7 +287,7 @@ void *vnodeGetVnode(int32_t vgId) {
SVnodeObj
**
ppVnode
=
(
SVnodeObj
**
)
taosGetIntHashData
(
tsDnodeVnodesHash
,
vgId
);
if
(
ppVnode
==
NULL
||
*
ppVnode
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_VGROUP_ID
;
dError
(
"vgId:%d not exist"
);
dError
(
"vgId:%d not exist"
,
vgId
);
return
NULL
;
}
...
...
@@ -611,7 +611,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"w"
);
if
(
!
fp
)
{
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
);
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
,
strerror
(
errno
)
);
return
errno
;
}
...
...
@@ -632,23 +632,23 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
return
0
;
}
static
int32_t
vnodeReadVersion
(
SVnodeObj
*
pVnode
)
{
static
bool
vnodeReadVersion
(
SVnodeObj
*
pVnode
)
{
char
versionFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"w"
);
if
(
!
fp
)
{
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
);
return
errno
;
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
,
strerror
(
errno
)
);
return
false
;
}
int
ret
=
TSDB_CODE_OTHERS
;
bool
ret
=
false
;
int
maxLen
=
100
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
int
len
=
fread
(
content
,
1
,
maxLen
,
fp
);
if
(
len
<=
0
)
{
free
(
content
);
fclose
(
fp
);
d
Error
(
"pVnode:%p vgId:%d, failed to read vnode version, content is null"
,
pVnode
,
pVnode
->
vgId
);
d
Print
(
"pVnode:%p vgId:%d, failed to read vnode version, content is null"
,
pVnode
,
pVnode
->
vgId
);
return
false
;
}
...
...
@@ -665,7 +665,7 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) {
}
pVnode
->
version
=
version
->
valueint
;
ret
=
0
;
ret
=
true
;
dPrint
(
"pVnode:%p vgId:%d, read vnode version successed, version:%%"
PRId64
,
pVnode
,
pVnode
->
vgId
,
pVnode
->
version
);
...
...
tests/script/general/account/testSuite.sim
已删除
100644 → 0
浏览文件 @
83727507
run general/account/pass_alter.sim
run general/account/pass_len.sim
run general/account/user_create.sim
run general/account/user_len.sim
run general/account/monitor.sim
\ No newline at end of file
tests/script/general/user/basic1.sim
浏览文件 @
644bfa40
...
...
@@ -13,6 +13,11 @@ print $data00 $data01 $data02
print $data10 $data11 $data22
print $data20 $data11 $data22
sql_error show accounts;
sql_error create account a pass "a"
sql_error drop account a
sql_error drop account root
print =============== create user1
sql create user user1 PASS 'user1'
sql show users
...
...
tests/script/unique/account/account_create.sim
浏览文件 @
644bfa40
...
...
@@ -2,11 +2,10 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/exec.sh -n dnode1 -s start
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
print ============================ dnode1 start
...
...
tests/script/unique/account/account_delete.sim
浏览文件 @
644bfa40
...
...
@@ -2,8 +2,8 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/exec.sh -n dnode1 -s start
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
@@ -53,7 +53,7 @@ if $rows != 0 then
return -1
endi
sql show dnodes
if $data0
2
!= 2 then
if $data0
3
!= 2 then
return -1
endi
sql drop account oroot
...
...
tests/script/unique/account/account_len.sim
浏览文件 @
644bfa40
...
...
@@ -2,8 +2,8 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/exec.sh -n dnode1 -s start
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
tests/script/unique/account/authority.sim
浏览文件 @
644bfa40
...
...
@@ -2,9 +2,9 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
tests/script/unique/account/basic.sim
浏览文件 @
644bfa40
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
system sh/exec_up
_up
.sh -n dnode1 -s start
sql connect
print =============== show accounts
...
...
tests/script/unique/account/monitor.sim
浏览文件 @
644bfa40
...
...
@@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c monitor -v 0
print ========== step1
system sh/cfg.sh -n dnode1 -c monitor -v 1
system sh/cfg.sh -n dnode1 -c monitorInterval -v 1
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
tests/script/unique/account/paras.sim
浏览文件 @
644bfa40
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
system sh/exec_up
_up
.sh -n dnode1 -s start
sql connect
print =============== show accounts
...
...
tests/script/unique/account/pass_alter.sim
浏览文件 @
644bfa40
...
...
@@ -2,8 +2,8 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/exec.sh -n dnode1 -s start
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
tests/script/unique/account/pass_len.sim
浏览文件 @
644bfa40
...
...
@@ -2,8 +2,8 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/exec.sh -n dnode1 -s start
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
tests/script/unique/account/testSuite.sim
浏览文件 @
644bfa40
run unique/account/account_create.sim
run unique/account/account_len.sim
run unique/account/account_delete.sim
run unique/account/pass_alter.sim
run unique/account/pass_len.sim
run unique/account/authority.sim
run unique/account/account_delete.sim
run unique/account/user_create.sim
run unique/account/user_len.sim
run unique/account/authority.sim
run unique/account/monitor.sim
tests/script/unique/account/usage.sim
浏览文件 @
644bfa40
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
system sh/exec_up
_up
.sh -n dnode1 -s start
sql connect
print =============== show accounts
...
...
tests/script/unique/account/user_create.sim
浏览文件 @
644bfa40
...
...
@@ -2,8 +2,8 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/exec.sh -n dnode1 -s start
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
tests/script/unique/account/user_len.sim
浏览文件 @
644bfa40
...
...
@@ -2,8 +2,8 @@ system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c c
ommitL
og -v 0
system sh/exec.sh -n dnode1 -s start
system sh/cfg.sh -n dnode1 -c c
l
og -v 0
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sleep 3000
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录