Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
63f825a7
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
63f825a7
编写于
3月 27, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-61]
上级
f1f30749
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
56 addition
and
9 deletion
+56
-9
CMakeLists.txt
CMakeLists.txt
+1
-0
src/inc/mnode.h
src/inc/mnode.h
+5
-6
src/mnode/inc/mgmtDb.h
src/mnode/inc/mgmtDb.h
+1
-0
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+1
-0
src/mnode/inc/mgmtSdb.h
src/mnode/inc/mgmtSdb.h
+1
-0
src/mnode/inc/mgmtUser.h
src/mnode/inc/mgmtUser.h
+2
-0
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+17
-0
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+0
-1
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+28
-2
未找到文件。
CMakeLists.txt
浏览文件 @
63f825a7
...
...
@@ -6,6 +6,7 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
SET
(
TD_CLUSTER FALSE
)
SET
(
TD_ACCOUNT FALSE
)
SET
(
TD_GRANT FALSE
)
SET
(
TD_COVER FALSE
)
SET
(
TD_PAGMODE_LITE FALSE
)
SET
(
TD_GODLL FALSE
)
...
...
src/inc/mnode.h
浏览文件 @
63f825a7
...
...
@@ -38,6 +38,10 @@ extern "C" {
#include "ttimer.h"
#include "tutil.h"
struct
_vg_obj
;
struct
_db_obj
;
struct
_acctObj
;
typedef
struct
{
int32_t
mnodeId
;
uint32_t
privateIp
;
...
...
@@ -103,8 +107,6 @@ typedef struct {
int8_t
dirty
;
}
STableInfo
;
struct
_vg_obj
;
typedef
struct
SSuperTableObj
{
STableInfo
info
;
uint64_t
uid
;
...
...
@@ -137,8 +139,6 @@ typedef struct {
SSuperTableObj
*
superTable
;
}
SChildTableObj
;
struct
_db_obj
;
typedef
struct
_vg_obj
{
uint32_t
vgId
;
char
dbName
[
TSDB_DB_NAME_LEN
+
1
];
...
...
@@ -170,10 +170,9 @@ typedef struct _db_obj {
int32_t
numOfSuperTables
;
SVgObj
*
pHead
;
SVgObj
*
pTail
;
struct
_acctObj
*
pAcct
;
}
SDbObj
;
struct
_acctObj
;
typedef
struct
_user_obj
{
char
user
[
TSDB_USER_LEN
+
1
];
char
pass
[
TSDB_KEY_LEN
+
1
];
...
...
src/mnode/inc/mgmtDb.h
浏览文件 @
63f825a7
...
...
@@ -28,6 +28,7 @@ void mgmtCleanUpDbs();
SDbObj
*
mgmtGetDb
(
char
*
db
);
SDbObj
*
mgmtGetDbByTableId
(
char
*
db
);
bool
mgmtCheckIsMonitorDB
(
char
*
db
,
char
*
monitordb
);
void
mgmtDropAllDbs
(
SAcctObj
*
pAcct
);
// util func
void
mgmtAddSuperTableIntoDb
(
SDbObj
*
pDb
);
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
63f825a7
...
...
@@ -25,6 +25,7 @@ int32_t mgmtInitDnodes();
void
mgmtCleanUpDnodes
();
int32_t
mgmtGetDnodesNum
();
int32_t
mgmtUpdateDnode
(
SDnodeObj
*
pDnode
);
void
*
mgmtGetNextDnode
(
SShowObj
*
pShow
,
SDnodeObj
**
pDnode
);
SDnodeObj
*
mgmtGetDnode
(
int32_t
dnodeId
);
SDnodeObj
*
mgmtGetDnodeByIp
(
uint32_t
ip
);
...
...
src/mnode/inc/mgmtSdb.h
浏览文件 @
63f825a7
...
...
@@ -63,6 +63,7 @@ int32_t sdbUpdateRow(SSdbOperDesc *pOper);
void
*
sdbGetRow
(
void
*
handle
,
void
*
key
);
void
*
sdbFetchRow
(
void
*
handle
,
void
*
pNode
,
void
**
ppRow
);
int64_t
sdbGetNumOfRows
(
void
*
handle
);
int64_t
sdbGetId
(
void
*
handle
);
uint64_t
sdbGetVersion
();
#ifdef __cplusplus
...
...
src/mnode/inc/mgmtUser.h
浏览文件 @
63f825a7
...
...
@@ -25,6 +25,8 @@ int32_t mgmtInitUsers();
void
mgmtCleanUpUsers
();
SUserObj
*
mgmtGetUser
(
char
*
name
);
SUserObj
*
mgmtGetUserFromConn
(
void
*
pConn
,
bool
*
usePublicIp
);
int32_t
mgmtCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
);
void
mgmtDropAllUsers
(
SAcctObj
*
pAcct
);
#ifdef __cplusplus
}
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
63f825a7
...
...
@@ -899,3 +899,20 @@ static void mgmtProcessDropDbMsg(SQueuedMsg *pMsg) {
newMsg
->
ahandle
=
pDb
;
taosTmrReset
(
mgmtDropDb
,
10
,
newMsg
,
tsMgmtTmr
,
&
tmpTmr
);
}
void
mgmtDropAllDbs
(
SAcctObj
*
pAcct
)
{
int32_t
numOfDbs
=
0
;
SDbObj
*
pDb
=
NULL
;
while
(
1
)
{
void
*
pNode
=
sdbFetchRow
(
tsDbSdb
,
pNode
,
(
void
**
)
&
pDb
);
if
(
pDb
==
NULL
)
break
;
if
(
pDb
->
pAcct
==
pAcct
)
{
mgmtSetDbDirty
(
pDb
);
numOfDbs
++
;
}
}
mTrace
(
"acct:%s, all dbs is is set dirty"
,
pAcct
->
acctId
,
numOfDbs
);
}
\ No newline at end of file
src/mnode/src/mgmtDnode.c
浏览文件 @
63f825a7
...
...
@@ -36,7 +36,6 @@ void * (*mgmtGetNextDnodeFp)(SShowObj *pShow, SDnodeObj **pDnode) = NULL;
void
(
*
mgmtSetDnodeUnRemoveFp
)(
SDnodeObj
*
pDnode
)
=
NULL
;
static
SDnodeObj
tsDnodeObj
=
{
0
};
static
void
*
mgmtGetNextDnode
(
SShowObj
*
pShow
,
SDnodeObj
**
pDnode
);
static
bool
mgmtCheckConfigShow
(
SGlobalConfig
*
cfg
);
static
int32_t
mgmtGetModuleMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
static
int32_t
mgmtRetrieveModules
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
63f825a7
...
...
@@ -28,7 +28,6 @@
static
void
*
tsUserSdb
=
NULL
;
static
int32_t
tsUserUpdateSize
=
0
;
static
int32_t
mgmtCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
);
static
int32_t
mgmtDropUser
(
SAcctObj
*
pAcct
,
char
*
name
);
static
int32_t
mgmtUpdateUser
(
SUserObj
*
pUser
);
static
int32_t
mgmtGetUserMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
...
...
@@ -155,7 +154,7 @@ static int32_t mgmtUpdateUser(SUserObj *pUser) {
return
code
;
}
static
int32_t
mgmtCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
)
{
int32_t
mgmtCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
)
{
int32_t
code
=
mgmtCheckUserLimit
(
pAcct
);
if
(
code
!=
0
)
{
return
code
;
...
...
@@ -482,3 +481,30 @@ static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg) {
mgmtSendSimpleResp
(
pMsg
->
thandle
,
code
);
}
void
mgmtDropAllUsers
(
SAcctObj
*
pAcct
)
{
void
*
pNode
=
NULL
;
void
*
pLastNode
=
NULL
;
int32_t
numOfUsers
=
0
;
int32_t
acctNameLen
=
strlen
(
pAcct
->
user
);
SUserObj
*
pUser
=
NULL
;
while
(
1
)
{
pNode
=
sdbFetchRow
(
tsUserSdb
,
pNode
,
(
void
**
)
&
pUser
);
if
(
pUser
==
NULL
)
break
;
if
(
strncmp
(
pUser
->
acct
,
pAcct
->
user
,
acctNameLen
)
==
0
)
{
SSdbOperDesc
oper
=
{
.
type
=
SDB_OPER_TYPE_LOCAL
,
.
table
=
tsUserSdb
,
.
pObj
=
pUser
,
};
sdbDeleteRow
(
&
oper
);
pNode
=
pLastNode
;
numOfUsers
++
;
continue
;
}
}
mTrace
(
"acct:%s, all users is dropped from sdb"
,
pAcct
->
acctId
,
numOfUsers
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录