Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ef5e2078
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看板
提交
ef5e2078
编写于
12月 30, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/dnode3' of
https://github.com/taosdata/TDengine
into feature/dnode3
上级
9c717d9c
96be7db9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
18 deletion
+29
-18
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+20
-14
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+6
-4
source/dnode/mnode/sdb/src/sdbRow.c
source/dnode/mnode/sdb/src/sdbRow.c
+3
-0
未找到文件。
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
ef5e2078
...
...
@@ -75,7 +75,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
if
(
pRaw
==
NULL
)
return
-
1
;
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
mDebug
(
"user:%s, will be created while deploy sdb
"
,
userObj
.
user
);
mDebug
(
"user:%s, will be created while deploy sdb
, raw:%p"
,
userObj
.
user
,
pRaw
);
return
sdbWrite
(
pMnode
->
pSdb
,
pRaw
);
}
...
...
@@ -107,6 +107,7 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_USER_RESERVE_SIZE
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
);
mTrace
(
"user:%s, encode to raw:%p, row:%p"
,
pUser
->
user
,
pRaw
,
pUser
);
return
pRaw
;
}
...
...
@@ -133,11 +134,12 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
superUser
)
SDB_GET_RESERVE
(
pRaw
,
pRow
,
dataPos
,
TSDB_USER_RESERVE_SIZE
)
mTrace
(
"user:%s, decode from raw:%p, row:%p"
,
pUser
->
user
,
pRaw
,
pUser
);
return
pRow
;
}
static
int32_t
mndUserActionInsert
(
SSdb
*
pSdb
,
SUserObj
*
pUser
)
{
mTrace
(
"user:%s, perform insert action
"
,
pUser
->
u
ser
);
mTrace
(
"user:%s, perform insert action
, row:%p"
,
pUser
->
user
,
pU
ser
);
pUser
->
prohibitDbHash
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
if
(
pUser
->
prohibitDbHash
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -158,7 +160,7 @@ static int32_t mndUserActionInsert(SSdb *pSdb, SUserObj *pUser) {
}
static
int32_t
mndUserActionDelete
(
SSdb
*
pSdb
,
SUserObj
*
pUser
)
{
mTrace
(
"user:%s, perform delete action
"
,
pUser
->
u
ser
);
mTrace
(
"user:%s, perform delete action
, row:%p"
,
pUser
->
user
,
pU
ser
);
if
(
pUser
->
prohibitDbHash
)
{
taosHashCleanup
(
pUser
->
prohibitDbHash
);
pUser
->
prohibitDbHash
=
NULL
;
...
...
@@ -168,7 +170,7 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
}
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pOldUser
,
SUserObj
*
pNewUser
)
{
mTrace
(
"user:%s, perform update action
"
,
pOldUser
->
u
ser
);
mTrace
(
"user:%s, perform update action
, old_row:%p new_row:%p"
,
pOldUser
->
user
,
pOldUser
,
pNewU
ser
);
memcpy
(
pOldUser
->
pass
,
pNewUser
->
pass
,
TSDB_PASSWORD_LEN
);
pOldUser
->
updateTime
=
pNewUser
->
updateTime
;
return
0
;
...
...
@@ -240,15 +242,15 @@ static int32_t mndProcessCreateUserMsg(SMnodeMsg *pMsg) {
return
-
1
;
}
SUserObj
*
pUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
pCreate
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pCreate
->
user
);
if
(
pUser
!=
NULL
)
{
sdbRelease
(
pMnode
->
pSdb
,
pUser
);
mndReleaseUser
(
pMnode
,
pUser
);
terrno
=
TSDB_CODE_MND_USER_ALREADY_EXIST
;
mError
(
"user:%s, failed to create since %s"
,
pCreate
->
user
,
terrstr
());
return
-
1
;
}
SUserObj
*
pOperUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
pMsg
->
user
);
SUserObj
*
pOperUser
=
mndAcquireUser
(
pMnode
,
pMsg
->
user
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
mError
(
"user:%s, failed to create since %s"
,
pCreate
->
user
,
terrstr
());
...
...
@@ -256,7 +258,7 @@ static int32_t mndProcessCreateUserMsg(SMnodeMsg *pMsg) {
}
int32_t
code
=
mndCreateUser
(
pMnode
,
pOperUser
->
acct
,
pCreate
->
user
,
pCreate
->
pass
,
pMsg
);
sdbRelease
(
pMnode
->
pSdb
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pOperUser
);
if
(
code
!=
0
)
{
mError
(
"user:%s, failed to create since %s"
,
pCreate
->
user
,
terrstr
());
...
...
@@ -310,15 +312,16 @@ static int32_t mndProcessAlterUserMsg(SMnodeMsg *pMsg) {
return
-
1
;
}
SUserObj
*
pUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
pAlter
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pAlter
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_USER_NOT_EXIST
;
mError
(
"user:%s, failed to alter since %s"
,
pAlter
->
user
,
terrstr
());
return
-
1
;
}
SUserObj
*
pOperUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
pMsg
->
user
);
SUserObj
*
pOperUser
=
mndAcquireUser
(
pMnode
,
pMsg
->
user
);
if
(
pOperUser
==
NULL
)
{
mndReleaseUser
(
pMnode
,
pUser
);
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
mError
(
"user:%s, failed to alter since %s"
,
pAlter
->
user
,
terrstr
());
return
-
1
;
...
...
@@ -331,7 +334,8 @@ static int32_t mndProcessAlterUserMsg(SMnodeMsg *pMsg) {
newUser
.
updateTime
=
taosGetTimestampMs
();
int32_t
code
=
mndUpdateUser
(
pMnode
,
pUser
,
&
newUser
,
pMsg
);
sdbRelease
(
pMnode
->
pSdb
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pUser
);
if
(
code
!=
0
)
{
mError
(
"user:%s, failed to alter since %s"
,
pAlter
->
user
,
terrstr
());
...
...
@@ -379,22 +383,24 @@ static int32_t mndProcessDropUserMsg(SMnodeMsg *pMsg) {
return
-
1
;
}
SUserObj
*
pUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
pDrop
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pDrop
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_USER_NOT_EXIST
;
mError
(
"user:%s, failed to drop since %s"
,
pDrop
->
user
,
terrstr
());
return
-
1
;
}
SUserObj
*
pOperUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
pMsg
->
user
);
SUserObj
*
pOperUser
=
mndAcquireUser
(
pMnode
,
pMsg
->
user
);
if
(
pOperUser
==
NULL
)
{
mndReleaseUser
(
pMnode
,
pUser
);
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
mError
(
"user:%s, failed to drop since %s"
,
pDrop
->
user
,
terrstr
());
return
-
1
;
}
int32_t
code
=
mndDropUser
(
pMnode
,
pMsg
,
pUser
);
sdbRelease
(
pMnode
->
pSdb
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pUser
);
if
(
code
!=
0
)
{
mError
(
"user:%s, failed to drop since %s"
,
pDrop
->
user
,
terrstr
());
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
ef5e2078
...
...
@@ -57,12 +57,14 @@ void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper) {
EKeyType
keyType
=
pSdb
->
keyTypes
[
pRow
->
type
];
if
(
keyType
==
SDB_KEY_BINARY
)
{
mTrace
(
"%s:%s, refCount:%d oper:%s"
,
sdbTableName
(
pRow
->
type
),
(
char
*
)
pRow
->
pObj
,
pRow
->
refCount
,
oper
);
mTrace
(
"%s:%s, refCount:%d oper:%s row:%p"
,
sdbTableName
(
pRow
->
type
),
(
char
*
)
pRow
->
pObj
,
pRow
->
refCount
,
oper
,
pRow
->
pObj
);
}
else
if
(
keyType
==
SDB_KEY_INT32
)
{
mTrace
(
"%s:%d, refCount:%d oper:%s"
,
sdbTableName
(
pRow
->
type
),
*
(
int32_t
*
)
pRow
->
pObj
,
pRow
->
refCount
,
oper
);
mTrace
(
"%s:%d, refCount:%d oper:%s row:%p"
,
sdbTableName
(
pRow
->
type
),
*
(
int32_t
*
)
pRow
->
pObj
,
pRow
->
refCount
,
oper
,
pRow
->
pObj
);
}
else
if
(
keyType
==
SDB_KEY_INT64
)
{
mTrace
(
"%s:%"
PRId64
", refCount:%d oper:%s
"
,
sdbTableName
(
pRow
->
type
),
*
(
int64_t
*
)
pRow
->
pObj
,
pRow
->
refCount
,
oper
);
mTrace
(
"%s:%"
PRId64
", refCount:%d oper:%s
row:%p"
,
sdbTableName
(
pRow
->
type
),
*
(
int64_t
*
)
pRow
->
pObj
,
pRow
->
refCount
,
oper
,
pRow
->
pObj
);
}
else
{
}
}
...
...
source/dnode/mnode/sdb/src/sdbRow.c
浏览文件 @
ef5e2078
...
...
@@ -23,6 +23,7 @@ SSdbRow *sdbAllocRow(int32_t objSize) {
return
NULL
;
}
mTrace
(
"row:%p, is created, len:%d"
,
pRow
->
pObj
,
objSize
);
return
pRow
;
}
...
...
@@ -43,5 +44,7 @@ void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow) {
}
sdbPrintOper
(
pSdb
,
pRow
,
"freeRow"
);
mTrace
(
"row:%p, is freed"
,
pRow
->
pObj
);
tfree
(
pRow
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录