Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2198001b
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看板
未验证
提交
2198001b
编写于
5月 05, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
5月 05, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12122 from taosdata/feature/dnode
test: add unitest for transaction
上级
0035bb11
9927b6b0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
249 addition
and
38 deletion
+249
-38
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+1
-0
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+9
-4
source/dnode/mnode/impl/test/trans/trans2.cpp
source/dnode/mnode/impl/test/trans/trans2.cpp
+239
-34
未找到文件。
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
2198001b
...
...
@@ -61,6 +61,7 @@ void mndTransSetDbInfo(STrans *pTrans, SDbObj *pDb);
int32_t
mndTransPrepare
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
void
mndTransProcessRsp
(
SNodeMsg
*
pRsp
);
void
mndTransPullup
(
SMnode
*
pMnode
);
int32_t
mndKillTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
2198001b
...
...
@@ -997,7 +997,12 @@ static int32_t mndTransSendActionMsg(SMnode *pMnode, STrans *pTrans, SArray *pAr
pAction
->
msgReceived
=
0
;
pAction
->
errCode
=
0
;
}
else
{
if
(
terrno
==
TSDB_CODE_INVALID_PTR
)
rpcFreeCont
(
rpcMsg
.
pCont
);
pAction
->
msgSent
=
0
;
pAction
->
msgReceived
=
0
;
pAction
->
errCode
=
terrno
;
if
(
terrno
==
TSDB_CODE_INVALID_PTR
||
terrno
==
TSDB_CODE_NODE_OFFLINE
)
{
rpcFreeCont
(
rpcMsg
.
pCont
);
}
mError
(
"trans:%d, action:%d not send since %s"
,
pTrans
->
id
,
action
,
terrstr
());
return
-
1
;
}
...
...
@@ -1275,7 +1280,7 @@ static int32_t mndProcessTransReq(SNodeMsg *pReq) {
return
0
;
}
static
int32_t
mndKillTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
int32_t
mndKillTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
SArray
*
pArray
=
NULL
;
if
(
pTrans
->
stage
==
TRN_STAGE_REDO_ACTION
)
{
pArray
=
pTrans
->
redoActions
;
...
...
@@ -1293,14 +1298,14 @@ static int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
if
(
pAction
==
NULL
)
continue
;
if
(
pAction
->
msgReceived
==
0
)
{
mInfo
(
"trans:%d, action:%d set processed"
,
pTrans
->
id
,
i
);
mInfo
(
"trans:%d, action:%d set processed
for kill msg received
"
,
pTrans
->
id
,
i
);
pAction
->
msgSent
=
1
;
pAction
->
msgReceived
=
1
;
pAction
->
errCode
=
0
;
}
if
(
pAction
->
errCode
!=
0
)
{
mInfo
(
"trans:%d, action:%d set processed, errCode from %s to success"
,
pTrans
->
id
,
i
,
mInfo
(
"trans:%d, action:%d set processed
for kill msg received
, errCode from %s to success"
,
pTrans
->
id
,
i
,
tstrerror
(
pAction
->
errCode
));
pAction
->
msgSent
=
1
;
pAction
->
msgReceived
=
1
;
...
...
source/dnode/mnode/impl/test/trans/trans2.cpp
浏览文件 @
2198001b
...
...
@@ -86,7 +86,7 @@ class MndTestTrans2 : public ::testing::Test {
void
SetUp
()
override
{}
void
TearDown
()
override
{}
int32_t
CreateUserLog
(
const
char
*
acct
,
const
char
*
user
)
{
int32_t
CreateUserLog
(
const
char
*
acct
,
const
char
*
user
,
ETrnType
type
,
SDbObj
*
pDb
)
{
SUserObj
userObj
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
"taosdata"
,
strlen
(
"taosdata"
),
userObj
.
pass
);
tstrncpy
(
userObj
.
user
,
user
,
TSDB_USER_LEN
);
...
...
@@ -96,7 +96,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj
.
superUser
=
1
;
SRpcMsg
rpcMsg
=
{
0
};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
&
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
type
,
&
rpcMsg
);
SSdbRaw
*
pRedoRaw
=
mndUserActionEncode
(
&
userObj
);
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
);
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_READY
);
...
...
@@ -108,13 +108,18 @@ class MndTestTrans2 : public ::testing::Test {
char
*
param
=
strdup
(
"====> test log <====="
);
mndTransSetCb
(
pTrans
,
TEST_TRANS_START_FUNC
,
TEST_TRANS_STOP_FUNC
,
param
,
strlen
(
param
)
+
1
);
if
(
pDb
!=
NULL
)
{
mndTransSetDbInfo
(
pTrans
,
pDb
);
}
int32_t
code
=
mndTransPrepare
(
pMnode
,
pTrans
);
mndTransDrop
(
pTrans
);
return
code
;
}
int32_t
CreateUserAction
(
const
char
*
acct
,
const
char
*
user
,
bool
hasUndoAction
,
ETrnPolicy
policy
)
{
int32_t
CreateUserAction
(
const
char
*
acct
,
const
char
*
user
,
bool
hasUndoAction
,
ETrnPolicy
policy
,
ETrnType
type
,
SDbObj
*
pDb
)
{
SUserObj
userObj
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
"taosdata"
,
strlen
(
"taosdata"
),
userObj
.
pass
);
tstrncpy
(
userObj
.
user
,
user
,
TSDB_USER_LEN
);
...
...
@@ -124,7 +129,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj
.
superUser
=
1
;
SRpcMsg
rpcMsg
=
{
0
};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
policy
,
TRN_TYPE_CREATE_USER
,
&
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
policy
,
type
,
&
rpcMsg
);
SSdbRaw
*
pRedoRaw
=
mndUserActionEncode
(
&
userObj
);
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
);
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_READY
);
...
...
@@ -170,6 +175,44 @@ class MndTestTrans2 : public ::testing::Test {
mndTransAppendUndoAction
(
pTrans
,
&
action
);
}
{
void
*
pRsp
=
taosMemoryCalloc
(
1
,
256
);
strcpy
((
char
*
)
pRsp
,
"simple rsponse"
);
mndTransSetRpcRsp
(
pTrans
,
pRsp
,
256
);
}
if
(
pDb
!=
NULL
)
{
mndTransSetDbInfo
(
pTrans
,
pDb
);
}
int32_t
code
=
mndTransPrepare
(
pMnode
,
pTrans
);
mndTransDrop
(
pTrans
);
return
code
;
}
int32_t
CreateUserGlobal
(
const
char
*
acct
,
const
char
*
user
)
{
SUserObj
userObj
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
"taosdata"
,
strlen
(
"taosdata"
),
userObj
.
pass
);
tstrncpy
(
userObj
.
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
userObj
.
acct
,
acct
,
TSDB_USER_LEN
);
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
superUser
=
1
;
SRpcMsg
rpcMsg
=
{
0
};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
&
rpcMsg
);
SSdbRaw
*
pRedoRaw
=
mndUserActionEncode
(
&
userObj
);
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
);
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_READY
);
SSdbRaw
*
pUndoRaw
=
mndUserActionEncode
(
&
userObj
);
mndTransAppendUndolog
(
pTrans
,
pUndoRaw
);
sdbSetRawStatus
(
pUndoRaw
,
SDB_STATUS_DROPPED
);
char
*
param
=
strdup
(
"====> test log <====="
);
mndTransSetCb
(
pTrans
,
TEST_TRANS_START_FUNC
,
TEST_TRANS_STOP_FUNC
,
param
,
strlen
(
param
)
+
1
);
int32_t
code
=
mndTransPrepare
(
pMnode
,
pTrans
);
mndTransDrop
(
pTrans
);
...
...
@@ -189,12 +232,12 @@ TEST_F(MndTestTrans2, 01_Log) {
ASSERT_NE
(
pMnode
,
nullptr
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user1
),
0
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user1
,
TRN_TYPE_CREATE_USER
,
NULL
),
0
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_NE
(
pUser1
,
nullptr
);
// failed to create user and rollback
EXPECT_EQ
(
CreateUserLog
(
acct_invalid
,
user2
),
0
);
EXPECT_EQ
(
CreateUserLog
(
acct_invalid
,
user2
,
TRN_TYPE_CREATE_USER
,
NULL
),
0
);
pUser2
=
mndAcquireUser
(
pMnode
,
user2
);
ASSERT_EQ
(
pUser2
,
nullptr
);
...
...
@@ -214,44 +257,46 @@ TEST_F(MndTestTrans2, 02_Action) {
ASSERT_NE
(
pMnode
,
nullptr
);
// failed to create user and rollback
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
false
,
TRN_POLICY_ROLLBACK
),
0
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_EQ
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
// create user, and fake a response
{
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
true
,
TRN_POLICY_ROLLBACK
),
0
);
// failed to create user and rollback
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
false
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
NULL
),
0
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_
NE
(
pUser1
,
nullptr
);
ASSERT_
EQ
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
transId
=
4
;
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
EXPECT_EQ
(
pTrans
->
code
,
TSDB_CODE_INVALID_PTR
);
EXPECT_EQ
(
pTrans
->
stage
,
TRN_STAGE_UNDO_ACTION
);
EXPECT_EQ
(
pTrans
->
failedTimes
,
1
);
// create user, and fake a response
{
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
true
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
NULL
),
0
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_NE
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
STransAction
*
pAction
=
(
STransAction
*
)
taosArrayGet
(
pTrans
->
undoActions
,
action
);
pAction
->
msgSent
=
1
;
transId
=
4
;
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
EXPECT_EQ
(
pTrans
->
code
,
TSDB_CODE_INVALID_PTR
);
EXPECT_EQ
(
pTrans
->
stage
,
TRN_STAGE_UNDO_ACTION
);
EXPECT_EQ
(
pTrans
->
failedTimes
,
1
);
SNodeMsg
rspMsg
=
{
0
};
rspMsg
.
pNode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
STransAction
*
pAction
=
(
STransAction
*
)
taosArrayGet
(
pTrans
->
undoActions
,
action
);
pAction
->
msgSent
=
1
;
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_EQ
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
SNodeMsg
rspMsg
=
{
0
};
rspMsg
.
pNode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_EQ
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
}
}
{
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
false
,
TRN_POLICY_RETRY
),
0
);
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
false
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_USER
,
NULL
),
0
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_NE
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
...
...
@@ -305,4 +350,164 @@ TEST_F(MndTestTrans2, 02_Action) {
mndReleaseUser
(
pMnode
,
pUser1
);
}
}
{
EXPECT_EQ
(
CreateUserAction
(
acct
,
user2
,
true
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
NULL
),
0
);
SUserObj
*
pUser2
=
(
SUserObj
*
)
sdbAcquire
(
pMnode
->
pSdb
,
SDB_USER
,
user2
);
ASSERT_NE
(
pUser2
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser2
);
{
transId
=
6
;
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
EXPECT_EQ
(
pTrans
->
code
,
TSDB_CODE_INVALID_PTR
);
EXPECT_EQ
(
pTrans
->
stage
,
TRN_STAGE_UNDO_ACTION
);
EXPECT_EQ
(
pTrans
->
failedTimes
,
1
);
SNodeMsg
rspMsg
=
{
0
};
rspMsg
.
pNode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
rpcMsg
.
code
=
0
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
pUser2
=
mndAcquireUser
(
pMnode
,
user2
);
ASSERT_NE
(
pUser2
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser2
);
}
{
transId
=
6
;
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
EXPECT_EQ
(
pTrans
->
code
,
TSDB_CODE_INVALID_PTR
);
EXPECT_EQ
(
pTrans
->
stage
,
TRN_STAGE_UNDO_ACTION
);
EXPECT_EQ
(
pTrans
->
failedTimes
,
2
);
STransAction
*
pAction
=
(
STransAction
*
)
taosArrayGet
(
pTrans
->
undoActions
,
action
);
pAction
->
msgSent
=
1
;
SNodeMsg
rspMsg
=
{
0
};
rspMsg
.
pNode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
pUser2
=
mndAcquireUser
(
pMnode
,
user2
);
ASSERT_EQ
(
pUser2
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser2
);
}
}
}
TEST_F
(
MndTestTrans2
,
03
_Kill
)
{
const
char
*
acct
=
"root"
;
const
char
*
user1
=
"kill1"
;
const
char
*
user2
=
"kill2"
;
SUserObj
*
pUser1
=
NULL
;
SUserObj
*
pUser2
=
NULL
;
STrans
*
pTrans
=
NULL
;
int32_t
transId
=
0
;
int32_t
action
=
0
;
ASSERT_NE
(
pMnode
,
nullptr
);
{
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
true
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
NULL
),
0
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_NE
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
transId
=
7
;
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
EXPECT_EQ
(
pTrans
->
code
,
TSDB_CODE_INVALID_PTR
);
EXPECT_EQ
(
pTrans
->
stage
,
TRN_STAGE_UNDO_ACTION
);
EXPECT_EQ
(
pTrans
->
failedTimes
,
1
);
mndKillTrans
(
pMnode
,
pTrans
);
mndReleaseTrans
(
pMnode
,
pTrans
);
pUser1
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_EQ
(
pUser1
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser1
);
}
}
TEST_F
(
MndTestTrans2
,
04
_Conflict
)
{
const
char
*
acct
=
"root"
;
const
char
*
user1
=
"conflict1"
;
const
char
*
user2
=
"conflict2"
;
const
char
*
user3
=
"conflict3"
;
const
char
*
user4
=
"conflict4"
;
const
char
*
user5
=
"conflict5"
;
const
char
*
user6
=
"conflict6"
;
const
char
*
user7
=
"conflict7"
;
const
char
*
user8
=
"conflict8"
;
SUserObj
*
pUser
=
NULL
;
STrans
*
pTrans
=
NULL
;
int32_t
transId
=
0
;
int32_t
code
=
0
;
ASSERT_NE
(
pMnode
,
nullptr
);
{
SDbObj
dbObj1
=
{
0
};
dbObj1
.
uid
=
9521
;
strcpy
(
dbObj1
.
name
,
"db"
);
SDbObj
dbObj2
=
{
0
};
dbObj2
.
uid
=
9522
;
strcpy
(
dbObj2
.
name
,
"conflict db"
);
EXPECT_EQ
(
CreateUserAction
(
acct
,
user1
,
true
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_STB
,
&
dbObj1
),
0
);
pUser
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_NE
(
pUser
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser
);
transId
=
8
;
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
EXPECT_EQ
(
pTrans
->
code
,
TSDB_CODE_INVALID_PTR
);
EXPECT_EQ
(
pTrans
->
stage
,
TRN_STAGE_UNDO_ACTION
);
// stb scope
EXPECT_EQ
(
CreateUserLog
(
acct
,
user2
,
TRN_TYPE_CREATE_DNODE
,
NULL
),
-
1
);
code
=
terrno
;
EXPECT_EQ
(
code
,
TSDB_CODE_MND_TRANS_CONFLICT
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user2
,
TRN_TYPE_CREATE_DB
,
&
dbObj1
),
-
1
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user2
,
TRN_TYPE_CREATE_DB
,
&
dbObj2
),
0
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user3
,
TRN_TYPE_CREATE_STB
,
&
dbObj1
),
0
);
// db scope
pTrans
->
type
=
TRN_TYPE_CREATE_DB
;
EXPECT_EQ
(
CreateUserLog
(
acct
,
user4
,
TRN_TYPE_CREATE_DNODE
,
NULL
),
-
1
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user4
,
TRN_TYPE_CREATE_DB
,
&
dbObj1
),
-
1
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user4
,
TRN_TYPE_CREATE_DB
,
&
dbObj2
),
0
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user5
,
TRN_TYPE_CREATE_STB
,
&
dbObj1
),
-
1
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user5
,
TRN_TYPE_CREATE_STB
,
&
dbObj2
),
0
);
// global scope
pTrans
->
type
=
TRN_TYPE_CREATE_DNODE
;
EXPECT_EQ
(
CreateUserLog
(
acct
,
user6
,
TRN_TYPE_CREATE_DNODE
,
NULL
),
0
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user7
,
TRN_TYPE_CREATE_DB
,
&
dbObj1
),
-
1
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user7
,
TRN_TYPE_CREATE_DB
,
&
dbObj2
),
-
1
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user7
,
TRN_TYPE_CREATE_STB
,
&
dbObj1
),
-
1
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user7
,
TRN_TYPE_CREATE_STB
,
&
dbObj2
),
-
1
);
// global scope
pTrans
->
type
=
TRN_TYPE_CREATE_USER
;
EXPECT_EQ
(
CreateUserLog
(
acct
,
user7
,
TRN_TYPE_CREATE_DB
,
&
dbObj1
),
0
);
EXPECT_EQ
(
CreateUserLog
(
acct
,
user8
,
TRN_TYPE_CREATE_DB
,
&
dbObj2
),
0
);
mndKillTrans
(
pMnode
,
pTrans
);
mndReleaseTrans
(
pMnode
,
pTrans
);
pUser
=
mndAcquireUser
(
pMnode
,
user1
);
ASSERT_EQ
(
pUser
,
nullptr
);
mndReleaseUser
(
pMnode
,
pUser
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录