Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
19d54f6f
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看板
提交
19d54f6f
编写于
12月 07, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 user update
上级
5252e177
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
347 addition
and
98 deletion
+347
-98
include/dnode/mnode/sdb/sdb.h
include/dnode/mnode/sdb/sdb.h
+2
-1
source/dnode/mgmt/impl/test/CMakeLists.txt
source/dnode/mgmt/impl/test/CMakeLists.txt
+5
-4
source/dnode/mgmt/impl/test/user/user.cpp
source/dnode/mgmt/impl/test/user/user.cpp
+122
-25
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+9
-9
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+3
-3
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+7
-7
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+5
-5
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+6
-6
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+166
-17
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+22
-21
未找到文件。
include/dnode/mnode/sdb/sdb.h
浏览文件 @
19d54f6f
...
@@ -125,7 +125,8 @@ typedef enum { SDB_KEY_BINARY = 1, SDB_KEY_INT32 = 2, SDB_KEY_INT64 = 3 } EKeyTy
...
@@ -125,7 +125,8 @@ typedef enum { SDB_KEY_BINARY = 1, SDB_KEY_INT32 = 2, SDB_KEY_INT64 = 3 } EKeyTy
typedef
enum
{
typedef
enum
{
SDB_STATUS_CREATING
=
1
,
SDB_STATUS_CREATING
=
1
,
SDB_STATUS_READY
=
2
,
SDB_STATUS_READY
=
2
,
SDB_STATUS_DROPPED
=
3
SDB_STATUS_DROPPING
=
3
,
SDB_STATUS_DROPPED
=
4
}
ESdbStatus
;
}
ESdbStatus
;
typedef
enum
{
typedef
enum
{
...
...
source/dnode/mgmt/impl/test/CMakeLists.txt
浏览文件 @
19d54f6f
add_subdirectory
(
acct
)
# add_subdirectory(acct)
add_subdirectory
(
cluster
)
# add_subdirectory(cluster)
add_subdirectory
(
profile
)
# add_subdirectory(profile)
add_subdirectory
(
show
)
# add_subdirectory(show)
add_subdirectory
(
user
)
source/dnode/mgmt/impl/test/user/user.cpp
浏览文件 @
19d54f6f
...
@@ -222,7 +222,6 @@ TEST_F(DndTestUser, CreateUser_01) {
...
@@ -222,7 +222,6 @@ TEST_F(DndTestUser, CreateUser_01) {
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_USER
;
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_USER
;
sendMsg
(
pClient
,
&
rpcMsg
);
sendMsg
(
pClient
,
&
rpcMsg
);
// taosMsleep(10000000);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
...
@@ -277,34 +276,132 @@ TEST_F(DndTestUser, CreateUser_01) {
...
@@ -277,34 +276,132 @@ TEST_F(DndTestUser, CreateUser_01) {
}
}
}
}
// TEST_F(DndTestUser, AlterUser) {
TEST_F
(
DndTestUser
,
AlterUser_01
)
{
// ASSERT_NE(pClient, nullptr);
ASSERT_NE
(
pClient
,
nullptr
);
//--- drop user ---
SAlterUserMsg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p2"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SDropUserMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_ALTER_USER
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
//--- meta ---
SShowMsg
*
pShow
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
pShow
->
type
=
TSDB_MGMT_TABLE_USER
;
SRpcMsg
showRpcMsg
=
{
0
};
showRpcMsg
.
pCont
=
pShow
;
showRpcMsg
.
contLen
=
sizeof
(
SShowMsg
);
showRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW
;
sendMsg
(
pClient
,
&
showRpcMsg
);
SShowRsp
*
pShowRsp
=
(
SShowRsp
*
)
pClient
->
pRsp
->
pCont
;
STableMetaMsg
*
pMeta
=
&
pShowRsp
->
tableMeta
;
pMeta
->
numOfColumns
=
htons
(
pMeta
->
numOfColumns
);
EXPECT_EQ
(
pMeta
->
numOfColumns
,
4
);
//--- retrieve ---
SRetrieveTableMsg
*
pRetrieve
=
(
SRetrieveTableMsg
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableMsg
));
pRetrieve
->
showId
=
pShowRsp
->
showId
;
SRpcMsg
retrieveRpcMsg
=
{
0
};
retrieveRpcMsg
.
pCont
=
pRetrieve
;
retrieveRpcMsg
.
contLen
=
sizeof
(
SRetrieveTableMsg
);
retrieveRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW_RETRIEVE
;
sendMsg
(
pClient
,
&
retrieveRpcMsg
);
SRetrieveTableRsp
*
pRetrieveRsp
=
(
SRetrieveTableRsp
*
)
pClient
->
pRsp
->
pCont
;
pRetrieveRsp
->
numOfRows
=
htonl
(
pRetrieveRsp
->
numOfRows
);
EXPECT_EQ
(
pRetrieveRsp
->
numOfRows
,
3
);
char
*
pData
=
pRetrieveRsp
->
data
;
int32_t
pos
=
0
;
char
*
strVal
=
NULL
;
//--- name ---
{
pos
+=
sizeof
(
VarDataLenT
);
strVal
=
(
char
*
)(
pData
+
pos
);
pos
+=
TSDB_USER_LEN
;
EXPECT_STREQ
(
strVal
,
"u1"
);
pos
+=
sizeof
(
VarDataLenT
);
strVal
=
(
char
*
)(
pData
+
pos
);
pos
+=
TSDB_USER_LEN
;
EXPECT_STREQ
(
strVal
,
"root"
);
pos
+=
sizeof
(
VarDataLenT
);
strVal
=
(
char
*
)(
pData
+
pos
);
pos
+=
TSDB_USER_LEN
;
EXPECT_STREQ
(
strVal
,
"_root"
);
}
}
// SAlterUserMsg* pReq = (SAlterUserMsg*)rpcMallocCont(sizeof(SAlterUserMsg));
TEST_F
(
DndTestUser
,
DropUser_01
)
{
ASSERT_NE
(
pClient
,
nullptr
);
// SRpcMsg rpcMsg = {0};
//--- drop user ---
// rpcMsg.pCont = pReq;
SDropUserMsg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
sizeof
(
SDropUserMsg
));
// rpcMsg.contLen = sizeof(SAlterUserMsg);
strcpy
(
pReq
->
user
,
"u1"
);
// rpcMsg.msgType = TSDB_MSG_TYPE_ALTER_ACCT;
// sendMsg(pClient, &rpcMsg);
SRpcMsg
rpcMsg
=
{
0
};
// SRpcMsg* pMsg = pClient->pRsp;
rpcMsg
.
pCont
=
pReq
;
// ASSERT_NE(pMsg, nullptr);
rpcMsg
.
contLen
=
sizeof
(
SDropUserMsg
);
// ASSERT_EQ(pMsg->code, TSDB_CODE_MND_MSG_NOT_PROCESSED);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_USER
;
// }
// TEST_F(DndTestUser, DropUser) {
sendMsg
(
pClient
,
&
rpcMsg
);
// ASSERT_NE(pClient, nullptr);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
// SDropUserMsg* pReq = (SDropUserMsg*)rpcMallocCont(sizeof(SDropUserMsg));
//--- meta ---
SShowMsg
*
pShow
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
pShow
->
type
=
TSDB_MGMT_TABLE_USER
;
SRpcMsg
showRpcMsg
=
{
0
};
showRpcMsg
.
pCont
=
pShow
;
showRpcMsg
.
contLen
=
sizeof
(
SShowMsg
);
showRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW
;
// SRpcMsg rpcMsg = {0};
sendMsg
(
pClient
,
&
showRpcMsg
);
// rpcMsg.pCont = pReq;
SShowRsp
*
pShowRsp
=
(
SShowRsp
*
)
pClient
->
pRsp
->
pCont
;
// rpcMsg.contLen = sizeof(SDropUserMsg);
STableMetaMsg
*
pMeta
=
&
pShowRsp
->
tableMeta
;
// rpcMsg.msgType = TSDB_MSG_TYPE_DROP_ACCT;
pMeta
->
numOfColumns
=
htons
(
pMeta
->
numOfColumns
);
EXPECT_EQ
(
pMeta
->
numOfColumns
,
4
);
// sendMsg(pClient, &rpcMsg);
//--- retrieve ---
// SRpcMsg* pMsg = pClient->pRsp;
SRetrieveTableMsg
*
pRetrieve
=
(
SRetrieveTableMsg
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableMsg
));
// ASSERT_NE(pMsg, nullptr);
pRetrieve
->
showId
=
pShowRsp
->
showId
;
// ASSERT_EQ(pMsg->code, TSDB_CODE_MND_MSG_NOT_PROCESSED);
SRpcMsg
retrieveRpcMsg
=
{
0
};
// }
retrieveRpcMsg
.
pCont
=
pRetrieve
;
retrieveRpcMsg
.
contLen
=
sizeof
(
SRetrieveTableMsg
);
retrieveRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW_RETRIEVE
;
sendMsg
(
pClient
,
&
retrieveRpcMsg
);
SRetrieveTableRsp
*
pRetrieveRsp
=
(
SRetrieveTableRsp
*
)
pClient
->
pRsp
->
pCont
;
pRetrieveRsp
->
numOfRows
=
htonl
(
pRetrieveRsp
->
numOfRows
);
EXPECT_EQ
(
pRetrieveRsp
->
numOfRows
,
2
);
char
*
pData
=
pRetrieveRsp
->
data
;
int32_t
pos
=
0
;
char
*
strVal
=
NULL
;
//--- name ---
{
pos
+=
sizeof
(
VarDataLenT
);
strVal
=
(
char
*
)(
pData
+
pos
);
pos
+=
TSDB_USER_LEN
;
EXPECT_STREQ
(
strVal
,
"root"
);
pos
+=
sizeof
(
VarDataLenT
);
strVal
=
(
char
*
)(
pData
+
pos
);
pos
+=
TSDB_USER_LEN
;
EXPECT_STREQ
(
strVal
,
"_root"
);
}
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
19d54f6f
...
@@ -24,7 +24,7 @@ static SSdbRaw *mnodeAcctActionEncode(SAcctObj *pAcct);
...
@@ -24,7 +24,7 @@ static SSdbRaw *mnodeAcctActionEncode(SAcctObj *pAcct);
static
SSdbRow
*
mnodeAcctActionDecode
(
SSdbRaw
*
pRaw
);
static
SSdbRow
*
mnodeAcctActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mnodeAcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mnodeAcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mnodeAcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mnodeAcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mnodeAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
p
SrcAcct
,
SAcctObj
*
pDst
Acct
);
static
int32_t
mnodeAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
p
OldAcct
,
SAcctObj
*
pNew
Acct
);
static
int32_t
mndProcessCreateAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
static
int32_t
mndProcessCreateAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
static
int32_t
mndProcessAlterAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
static
int32_t
mndProcessAlterAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
static
int32_t
mndProcessDropAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
static
int32_t
mndProcessDropAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
...
@@ -131,15 +131,15 @@ static int32_t mnodeAcctActionDelete(SSdb *pSdb, SAcctObj *pAcct) {
...
@@ -131,15 +131,15 @@ static int32_t mnodeAcctActionDelete(SSdb *pSdb, SAcctObj *pAcct) {
return
0
;
return
0
;
}
}
static
int32_t
mnodeAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
p
SrcAcct
,
SAcctObj
*
pDst
Acct
)
{
static
int32_t
mnodeAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
p
OldAcct
,
SAcctObj
*
pNew
Acct
)
{
mTrace
(
"acct:%s, perform update action"
,
p
Dst
Acct
->
acct
);
mTrace
(
"acct:%s, perform update action"
,
p
Old
Acct
->
acct
);
memcpy
(
p
DstAcct
->
acct
,
pSrc
Acct
->
acct
,
TSDB_USER_LEN
);
memcpy
(
p
OldAcct
->
acct
,
pNew
Acct
->
acct
,
TSDB_USER_LEN
);
p
DstAcct
->
createdTime
=
pSrc
Acct
->
createdTime
;
p
OldAcct
->
createdTime
=
pNew
Acct
->
createdTime
;
p
DstAcct
->
updateTime
=
pSrc
Acct
->
updateTime
;
p
OldAcct
->
updateTime
=
pNew
Acct
->
updateTime
;
p
DstAcct
->
acctId
=
pSrc
Acct
->
acctId
;
p
OldAcct
->
acctId
=
pNew
Acct
->
acctId
;
p
DstAcct
->
status
=
pSrc
Acct
->
status
;
p
OldAcct
->
status
=
pNew
Acct
->
status
;
p
DstAcct
->
cfg
=
pSrc
Acct
->
cfg
;
p
OldAcct
->
cfg
=
pNew
Acct
->
cfg
;
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
19d54f6f
...
@@ -24,7 +24,7 @@ static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster);
...
@@ -24,7 +24,7 @@ static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster);
static
SSdbRow
*
mndClusterActionDecode
(
SSdbRaw
*
pRaw
);
static
SSdbRow
*
mndClusterActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndClusterActionInsert
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionInsert
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionDelete
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionDelete
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
p
SrcCluster
,
SClusterObj
*
pDst
Cluster
);
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
p
OldCluster
,
SClusterObj
*
pNew
Cluster
);
static
int32_t
mndCreateDefaultCluster
(
SMnode
*
pMnode
);
static
int32_t
mndCreateDefaultCluster
(
SMnode
*
pMnode
);
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveClusters
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveClusters
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
...
@@ -107,8 +107,8 @@ static int32_t mndClusterActionDelete(SSdb *pSdb, SClusterObj *pCluster) {
...
@@ -107,8 +107,8 @@ static int32_t mndClusterActionDelete(SSdb *pSdb, SClusterObj *pCluster) {
return
0
;
return
0
;
}
}
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
p
SrcCluster
,
SClusterObj
*
pDst
Cluster
)
{
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
p
OldCluster
,
SClusterObj
*
pNew
Cluster
)
{
mTrace
(
"cluster:%d, perform update action"
,
p
Dst
Cluster
->
id
);
mTrace
(
"cluster:%d, perform update action"
,
p
Old
Cluster
->
id
);
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
19d54f6f
...
@@ -101,13 +101,13 @@ static int32_t mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode) {
...
@@ -101,13 +101,13 @@ static int32_t mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode) {
return
0
;
return
0
;
}
}
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
p
SrcDnode
,
SDnodeObj
*
pDst
Dnode
)
{
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
p
OldDnode
,
SDnodeObj
*
pNew
Dnode
)
{
mTrace
(
"dnode:%d, perform update action"
,
p
Dst
Dnode
->
id
);
mTrace
(
"dnode:%d, perform update action"
,
p
Old
Dnode
->
id
);
p
DstDnode
->
id
=
pSrc
Dnode
->
id
;
p
OldDnode
->
id
=
pNew
Dnode
->
id
;
p
DstDnode
->
createdTime
=
pSrc
Dnode
->
createdTime
;
p
OldDnode
->
createdTime
=
pNew
Dnode
->
createdTime
;
p
DstDnode
->
updateTime
=
pSrc
Dnode
->
updateTime
;
p
OldDnode
->
updateTime
=
pNew
Dnode
->
updateTime
;
p
DstDnode
->
port
=
pSrc
Dnode
->
port
;
p
OldDnode
->
port
=
pNew
Dnode
->
port
;
memcpy
(
p
DstDnode
->
fqdn
,
pSrc
Dnode
->
fqdn
,
TSDB_FQDN_LEN
);
memcpy
(
p
OldDnode
->
fqdn
,
pNew
Dnode
->
fqdn
,
TSDB_FQDN_LEN
);
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
19d54f6f
...
@@ -81,11 +81,11 @@ static int32_t mndMnodeActionDelete(SSdb *pSdb, SMnodeObj *pMnodeObj) {
...
@@ -81,11 +81,11 @@ static int32_t mndMnodeActionDelete(SSdb *pSdb, SMnodeObj *pMnodeObj) {
return
0
;
return
0
;
}
}
static
int32_t
mndMnodeActionUpdate
(
SSdb
*
pSdb
,
SMnodeObj
*
p
SrcMnode
,
SMnodeObj
*
pDst
Mnode
)
{
static
int32_t
mndMnodeActionUpdate
(
SSdb
*
pSdb
,
SMnodeObj
*
p
OldMnode
,
SMnodeObj
*
pNew
Mnode
)
{
mTrace
(
"mnode:%d, perform update action"
,
p
Dst
Mnode
->
id
);
mTrace
(
"mnode:%d, perform update action"
,
p
Old
Mnode
->
id
);
p
DstMnode
->
id
=
pSrc
Mnode
->
id
;
p
OldMnode
->
id
=
pNew
Mnode
->
id
;
p
DstMnode
->
createdTime
=
pSrc
Mnode
->
createdTime
;
p
OldMnode
->
createdTime
=
pNew
Mnode
->
createdTime
;
p
DstMnode
->
updateTime
=
pSrc
Mnode
->
updateTime
;
p
OldMnode
->
updateTime
=
pNew
Mnode
->
updateTime
;
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
19d54f6f
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
static
SSdbRaw
*
mndTransActionEncode
(
STrans
*
pTrans
);
static
SSdbRaw
*
mndTransActionEncode
(
STrans
*
pTrans
);
static
SSdbRow
*
mndTransActionDecode
(
SSdbRaw
*
pRaw
);
static
SSdbRow
*
mndTransActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndTransActionInsert
(
SSdb
*
pSdb
,
STrans
*
pTrans
);
static
int32_t
mndTransActionInsert
(
SSdb
*
pSdb
,
STrans
*
pTrans
);
static
int32_t
mndTransActionUpdate
(
SSdb
*
pSdb
,
STrans
*
pTrans
,
STrans
*
pDst
Trans
);
static
int32_t
mndTransActionUpdate
(
SSdb
*
pSdb
,
STrans
*
OldTrans
,
STrans
*
pOld
Trans
);
static
int32_t
mndTransActionDelete
(
SSdb
*
pSdb
,
STrans
*
pTrans
);
static
int32_t
mndTransActionDelete
(
SSdb
*
pSdb
,
STrans
*
pTrans
);
int32_t
mndInitTrans
(
SMnode
*
pMnode
)
{
int32_t
mndInitTrans
(
SMnode
*
pMnode
)
{
...
@@ -244,22 +244,22 @@ static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans) {
...
@@ -244,22 +244,22 @@ static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans) {
return
0
;
return
0
;
}
}
static
int32_t
mndTransActionUpdate
(
SSdb
*
pSdb
,
STrans
*
p
Trans
,
STrans
*
pDst
Trans
)
{
static
int32_t
mndTransActionUpdate
(
SSdb
*
pSdb
,
STrans
*
p
OldTrans
,
STrans
*
pNew
Trans
)
{
mTrace
(
"trans:%d, perform update action, stage:%d"
,
p
Trans
->
id
,
p
Trans
->
stage
);
mTrace
(
"trans:%d, perform update action, stage:%d"
,
p
OldTrans
->
id
,
pNew
Trans
->
stage
);
SArray
*
pArray
=
p
Dst
Trans
->
commitLogs
;
SArray
*
pArray
=
p
Old
Trans
->
commitLogs
;
int32_t
arraySize
=
taosArrayGetSize
(
pArray
);
int32_t
arraySize
=
taosArrayGetSize
(
pArray
);
for
(
int32_t
i
=
0
;
i
<
arraySize
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
arraySize
;
++
i
)
{
SSdbRaw
*
pRaw
=
taosArrayGetP
(
pArray
,
i
);
SSdbRaw
*
pRaw
=
taosArrayGetP
(
pArray
,
i
);
int32_t
code
=
sdbWrite
(
pSdb
,
pRaw
);
int32_t
code
=
sdbWrite
(
pSdb
,
pRaw
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
mError
(
"trans:%d, failed to write raw:%p to sdb since %s"
,
p
Dst
Trans
->
id
,
pRaw
,
terrstr
());
mError
(
"trans:%d, failed to write raw:%p to sdb since %s"
,
p
Old
Trans
->
id
,
pRaw
,
terrstr
());
return
code
;
return
code
;
}
}
}
}
p
DstTrans
->
stage
=
p
Trans
->
stage
;
p
OldTrans
->
stage
=
pNew
Trans
->
stage
;
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
19d54f6f
...
@@ -27,7 +27,7 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser);
...
@@ -27,7 +27,7 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser);
static
SSdbRow
*
mndUserActionDecode
(
SSdbRaw
*
pRaw
);
static
SSdbRow
*
mndUserActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndUserActionInsert
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionInsert
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionDelete
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionDelete
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
p
SrcUser
,
SUserObj
*
pDst
User
);
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
p
OldUser
,
SUserObj
*
pNew
User
);
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
char
*
user
,
char
*
pass
,
SMnodeMsg
*
pMsg
);
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
char
*
user
,
char
*
pass
,
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateUserMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateUserMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterUserMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterUserMsg
(
SMnodeMsg
*
pMsg
);
...
@@ -168,16 +168,16 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
...
@@ -168,16 +168,16 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
return
0
;
return
0
;
}
}
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
p
SrcUser
,
SUserObj
*
pDst
User
)
{
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
p
OldUser
,
SUserObj
*
pNew
User
)
{
mTrace
(
"user:%s, perform update action"
,
p
Src
User
->
user
);
mTrace
(
"user:%s, perform update action"
,
p
Old
User
->
user
);
memcpy
(
p
DstUser
->
user
,
pSrc
User
->
user
,
TSDB_USER_LEN
);
memcpy
(
p
OldUser
->
user
,
pNew
User
->
user
,
TSDB_USER_LEN
);
memcpy
(
p
DstUser
->
pass
,
pSrc
User
->
pass
,
TSDB_KEY_LEN
);
memcpy
(
p
OldUser
->
pass
,
pNew
User
->
pass
,
TSDB_KEY_LEN
);
memcpy
(
p
DstUser
->
acct
,
pSrc
User
->
acct
,
TSDB_USER_LEN
);
memcpy
(
p
OldUser
->
acct
,
pNew
User
->
acct
,
TSDB_USER_LEN
);
p
DstUser
->
createdTime
=
pSrc
User
->
createdTime
;
p
OldUser
->
createdTime
=
pNew
User
->
createdTime
;
p
DstUser
->
updateTime
=
pSrc
User
->
updateTime
;
p
OldUser
->
updateTime
=
pNew
User
->
updateTime
;
p
DstUser
->
superAuth
=
pSrc
User
->
superAuth
;
p
OldUser
->
superAuth
=
pNew
User
->
superAuth
;
p
DstUser
->
readAuth
=
pSrc
User
->
readAuth
;
p
OldUser
->
readAuth
=
pNew
User
->
readAuth
;
p
DstUser
->
writeAuth
=
pSrc
User
->
writeAuth
;
p
OldUser
->
writeAuth
=
pNew
User
->
writeAuth
;
return
0
;
return
0
;
}
}
...
@@ -243,6 +243,82 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, char *user, char *pass,
...
@@ -243,6 +243,82 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, char *user, char *pass,
return
0
;
return
0
;
}
}
static
int32_t
mndUpdateUser
(
SMnode
*
pMnode
,
SUserObj
*
pOldUser
,
SUserObj
*
pNewUser
,
SMnodeMsg
*
pMsg
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
pMsg
->
rpcMsg
.
handle
);
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to update since %s"
,
pOldUser
->
user
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to update user:%s"
,
pTrans
->
id
,
pOldUser
->
user
);
SSdbRaw
*
pRedoRaw
=
mndUserActionEncode
(
pNewUser
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append redo log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_READY
);
SSdbRaw
*
pUndoRaw
=
mndUserActionEncode
(
pOldUser
);
if
(
pUndoRaw
==
NULL
||
mndTransAppendUndolog
(
pTrans
,
pUndoRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append undo log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
pUndoRaw
,
SDB_STATUS_READY
);
if
(
mndTransPrepare
(
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
mndTransDrop
(
pTrans
);
return
0
;
}
static
int32_t
mndDropUser
(
SMnode
*
pMnode
,
SUserObj
*
pUser
,
SMnodeMsg
*
pMsg
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
pMsg
->
rpcMsg
.
handle
);
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to drop since %s"
,
pUser
->
user
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pUser
->
user
);
SSdbRaw
*
pRedoRaw
=
mndUserActionEncode
(
pUser
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append redo log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_DROPPING
);
SSdbRaw
*
pUndoRaw
=
mndUserActionEncode
(
pUser
);
if
(
pUndoRaw
==
NULL
||
mndTransAppendUndolog
(
pTrans
,
pUndoRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append undo log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
pUndoRaw
,
SDB_STATUS_READY
);
SSdbRaw
*
pCommitRaw
=
mndUserActionEncode
(
pUser
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append commit log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_DROPPED
);
if
(
mndTransPrepare
(
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
mndTransDrop
(
pTrans
);
return
0
;
}
static
int32_t
mndProcessCreateUserMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessCreateUserMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCreateUserMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SCreateUserMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
...
@@ -288,15 +364,88 @@ static int32_t mndProcessCreateUserMsg(SMnodeMsg *pMsg) {
...
@@ -288,15 +364,88 @@ static int32_t mndProcessCreateUserMsg(SMnodeMsg *pMsg) {
}
}
static
int32_t
mndProcessAlterUserMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessAlterUserMsg
(
SMnodeMsg
*
pMsg
)
{
terrno
=
TSDB_CODE_MND_MSG_NOT_PROCESSED
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
mError
(
"failed to process alter user msg since %s"
,
terrstr
());
SAlterUserMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
return
-
1
;
mDebug
(
"user:%s, start to alter"
,
pAlter
->
user
);
if
(
pAlter
->
user
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_USER_FORMAT
;
mError
(
"user:%s, failed to alter since %s"
,
pAlter
->
user
,
terrstr
());
return
-
1
;
}
if
(
pAlter
->
pass
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_PASS_FORMAT
;
mError
(
"user:%s, failed to alter since %s"
,
pAlter
->
user
,
terrstr
());
return
-
1
;
}
SUserObj
*
pUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
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
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
mError
(
"user:%s, failed to alter since %s"
,
pAlter
->
user
,
terrstr
());
return
-
1
;
}
SUserObj
newUser
=
{
0
};
memcpy
(
&
newUser
,
pUser
,
sizeof
(
SUserObj
));
memset
(
pUser
->
pass
,
0
,
sizeof
(
pUser
->
pass
));
taosEncryptPass
((
uint8_t
*
)
pAlter
->
pass
,
strlen
(
pAlter
->
pass
),
pUser
->
pass
);
int32_t
code
=
mndUpdateUser
(
pMnode
,
pUser
,
&
newUser
,
pMsg
);
sdbRelease
(
pMnode
->
pSdb
,
pOperUser
);
if
(
code
!=
0
)
{
mError
(
"user:%s, failed to alter since %s"
,
pAlter
->
user
,
terrstr
());
return
-
1
;
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
static
int32_t
mndProcessDropUserMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessDropUserMsg
(
SMnodeMsg
*
pMsg
)
{
terrno
=
TSDB_CODE_MND_MSG_NOT_PROCESSED
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
mError
(
"failed to process drop user msg since %s"
,
terrstr
());
SDropUserMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
return
-
1
;
mDebug
(
"user:%s, start to drop"
,
pDrop
->
user
);
if
(
pDrop
->
user
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_USER_FORMAT
;
mError
(
"user:%s, failed to drop since %s"
,
pDrop
->
user
,
terrstr
());
return
-
1
;
}
SUserObj
*
pUser
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
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
);
if
(
pOperUser
==
NULL
)
{
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
,
pUser
,
pMsg
);
sdbRelease
(
pMnode
->
pSdb
,
pOperUser
);
if
(
code
!=
0
)
{
mError
(
"user:%s, failed to drop since %s"
,
pDrop
->
user
,
terrstr
());
return
-
1
;
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
static
int32_t
mndGetUserMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
static
int32_t
mndGetUserMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
19d54f6f
...
@@ -52,8 +52,8 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
...
@@ -52,8 +52,8 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
SRWLatch
*
pLock
=
&
pSdb
->
locks
[
pRow
->
type
];
SRWLatch
*
pLock
=
&
pSdb
->
locks
[
pRow
->
type
];
taosWLockLatch
(
pLock
);
taosWLockLatch
(
pLock
);
SSdbRow
*
p
Dst
Row
=
taosHashGet
(
hash
,
pRow
->
pObj
,
keySize
);
SSdbRow
*
p
Old
Row
=
taosHashGet
(
hash
,
pRow
->
pObj
,
keySize
);
if
(
p
Dst
Row
!=
NULL
)
{
if
(
p
Old
Row
!=
NULL
)
{
taosWUnLockLatch
(
pLock
);
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pRow
);
sdbFreeRow
(
pRow
);
return
TSDB_CODE_SDB_OBJ_ALREADY_THERE
;
return
TSDB_CODE_SDB_OBJ_ALREADY_THERE
;
...
@@ -85,28 +85,28 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
...
@@ -85,28 +85,28 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
return
0
;
return
0
;
}
}
static
int32_t
sdbUpdateRow
(
SSdb
*
pSdb
,
SHashObj
*
hash
,
SSdbRaw
*
pRaw
,
SSdbRow
*
pRow
,
int32_t
keySize
)
{
static
int32_t
sdbUpdateRow
(
SSdb
*
pSdb
,
SHashObj
*
hash
,
SSdbRaw
*
pRaw
,
SSdbRow
*
p
New
Row
,
int32_t
keySize
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
SRWLatch
*
pLock
=
&
pSdb
->
locks
[
pRow
->
type
];
SRWLatch
*
pLock
=
&
pSdb
->
locks
[
p
New
Row
->
type
];
taosRLockLatch
(
pLock
);
taosRLockLatch
(
pLock
);
SSdbRow
**
pp
DstRow
=
taosHashGet
(
hash
,
p
Row
->
pObj
,
keySize
);
SSdbRow
**
pp
OldRow
=
taosHashGet
(
hash
,
pNew
Row
->
pObj
,
keySize
);
if
(
pp
DstRow
==
NULL
||
*
ppDst
Row
==
NULL
)
{
if
(
pp
OldRow
==
NULL
||
*
ppOld
Row
==
NULL
)
{
taosRUnLockLatch
(
pLock
);
taosRUnLockLatch
(
pLock
);
return
sdbInsertRow
(
pSdb
,
hash
,
pRaw
,
pRow
,
keySize
);
return
sdbInsertRow
(
pSdb
,
hash
,
pRaw
,
p
New
Row
,
keySize
);
}
}
SSdbRow
*
p
DstRow
=
*
ppDst
Row
;
SSdbRow
*
p
OldRow
=
*
ppOld
Row
;
p
Dst
Row
->
status
=
pRaw
->
status
;
p
Old
Row
->
status
=
pRaw
->
status
;
taosRUnLockLatch
(
pLock
);
taosRUnLockLatch
(
pLock
);
SdbUpdateFp
updateFp
=
pSdb
->
updateFps
[
pRow
->
type
];
SdbUpdateFp
updateFp
=
pSdb
->
updateFps
[
p
New
Row
->
type
];
if
(
updateFp
!=
NULL
)
{
if
(
updateFp
!=
NULL
)
{
code
=
(
*
updateFp
)(
pSdb
,
p
Row
->
pObj
,
pDst
Row
->
pObj
);
code
=
(
*
updateFp
)(
pSdb
,
p
OldRow
->
pObj
,
pNew
Row
->
pObj
);
}
}
sdbFreeRow
(
pRow
);
sdbFreeRow
(
p
New
Row
);
return
code
;
return
code
;
}
}
...
@@ -116,24 +116,24 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
...
@@ -116,24 +116,24 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
SRWLatch
*
pLock
=
&
pSdb
->
locks
[
pRow
->
type
];
SRWLatch
*
pLock
=
&
pSdb
->
locks
[
pRow
->
type
];
taosWLockLatch
(
pLock
);
taosWLockLatch
(
pLock
);
SSdbRow
**
pp
Dst
Row
=
taosHashGet
(
hash
,
pRow
->
pObj
,
keySize
);
SSdbRow
**
pp
Old
Row
=
taosHashGet
(
hash
,
pRow
->
pObj
,
keySize
);
if
(
pp
DstRow
==
NULL
||
*
ppDst
Row
==
NULL
)
{
if
(
pp
OldRow
==
NULL
||
*
ppOld
Row
==
NULL
)
{
taosWUnLockLatch
(
pLock
);
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pRow
);
sdbFreeRow
(
pRow
);
return
TSDB_CODE_SDB_OBJ_NOT_THERE
;
return
TSDB_CODE_SDB_OBJ_NOT_THERE
;
}
}
SSdbRow
*
p
DstRow
=
*
ppDst
Row
;
SSdbRow
*
p
OldRow
=
*
ppOld
Row
;
p
Dst
Row
->
status
=
pRaw
->
status
;
p
Old
Row
->
status
=
pRaw
->
status
;
taosHashRemove
(
hash
,
p
Dst
Row
->
pObj
,
keySize
);
taosHashRemove
(
hash
,
p
Old
Row
->
pObj
,
keySize
);
taosWUnLockLatch
(
pLock
);
taosWUnLockLatch
(
pLock
);
SdbDeleteFp
deleteFp
=
pSdb
->
deleteFps
[
p
Dst
Row
->
type
];
SdbDeleteFp
deleteFp
=
pSdb
->
deleteFps
[
p
Old
Row
->
type
];
if
(
deleteFp
!=
NULL
)
{
if
(
deleteFp
!=
NULL
)
{
code
=
(
*
deleteFp
)(
pSdb
,
p
Dst
Row
->
pObj
);
code
=
(
*
deleteFp
)(
pSdb
,
p
Old
Row
->
pObj
);
}
}
sdbRelease
(
pSdb
,
p
Dst
Row
->
pObj
);
sdbRelease
(
pSdb
,
p
Old
Row
->
pObj
);
sdbFreeRow
(
pRow
);
sdbFreeRow
(
pRow
);
return
code
;
return
code
;
}
}
...
@@ -158,6 +158,7 @@ int32_t sdbWriteNotFree(SSdb *pSdb, SSdbRaw *pRaw) {
...
@@ -158,6 +158,7 @@ int32_t sdbWriteNotFree(SSdb *pSdb, SSdbRaw *pRaw) {
code
=
sdbInsertRow
(
pSdb
,
hash
,
pRaw
,
pRow
,
keySize
);
code
=
sdbInsertRow
(
pSdb
,
hash
,
pRaw
,
pRow
,
keySize
);
break
;
break
;
case
SDB_STATUS_READY
:
case
SDB_STATUS_READY
:
case
SDB_STATUS_DROPPING
:
code
=
sdbUpdateRow
(
pSdb
,
hash
,
pRaw
,
pRow
,
keySize
);
code
=
sdbUpdateRow
(
pSdb
,
hash
,
pRaw
,
pRow
,
keySize
);
break
;
break
;
case
SDB_STATUS_DROPPED
:
case
SDB_STATUS_DROPPED
:
...
@@ -200,7 +201,7 @@ void *sdbAcquire(SSdb *pSdb, ESdbType type, void *pKey) {
...
@@ -200,7 +201,7 @@ void *sdbAcquire(SSdb *pSdb, ESdbType type, void *pKey) {
case
SDB_STATUS_CREATING
:
case
SDB_STATUS_CREATING
:
terrno
=
TSDB_CODE_SDB_OBJ_CREATING
;
terrno
=
TSDB_CODE_SDB_OBJ_CREATING
;
break
;
break
;
case
SDB_STATUS_DROPP
ED
:
case
SDB_STATUS_DROPP
ING
:
terrno
=
TSDB_CODE_SDB_OBJ_DROPPING
;
terrno
=
TSDB_CODE_SDB_OBJ_DROPPING
;
break
;
break
;
default:
default:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录