Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ef05688e
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看板
提交
ef05688e
编写于
1月 09, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/dnode3' into feature/vnode
上级
d9343722
d23d223f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
132 addition
and
97 deletion
+132
-97
Jenkinsfile
Jenkinsfile
+11
-9
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+53
-52
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
+1
-1
source/dnode/mgmt/impl/test/snode/dsnode.cpp
source/dnode/mgmt/impl/test/snode/dsnode.cpp
+1
-1
source/dnode/mgmt/impl/test/vnode/vnode.cpp
source/dnode/mgmt/impl/test/vnode/vnode.cpp
+16
-6
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+22
-22
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+28
-6
未找到文件。
Jenkinsfile
浏览文件 @
ef05688e
...
...
@@ -105,15 +105,17 @@ pipeline {
abort_previous
()
abortPreviousBuilds
()
}
pre_test
()
sh
'''
cd ${WKC}/tests
./test-all.sh b1fq
'''
sh
'''
cd ${WKC}/debug
ctest
'''
timeout
(
time:
45
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
cd ${WKC}/tests
./test-all.sh b1fq
'''
sh
'''
cd ${WKC}/debug
ctest
'''
}
}
}
}
...
...
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
ef05688e
...
...
@@ -165,6 +165,8 @@ static void dndCloseVnode(SDnode *pDnode, SVnodeObj *pVnode) {
vnodeClose
(
pVnode
->
pImpl
);
pVnode
->
pImpl
=
NULL
;
dDebug
(
"vgId:%d, vnode is closed"
,
pVnode
->
vgId
);
free
(
pVnode
->
path
);
free
(
pVnode
->
db
);
free
(
pVnode
);
...
...
@@ -238,59 +240,57 @@ static int32_t dndGetVnodesFromFile(SDnode *pDnode, SWrapperCfg **ppCfgs, int32_
}
int32_t
vnodesNum
=
cJSON_GetArraySize
(
vnodes
);
if
(
vnodesNum
<=
0
)
{
dError
(
"failed to read %s since vnodes size:%d invalid"
,
file
,
vnodesNum
);
goto
PRASE_VNODE_OVER
;
}
if
(
vnodesNum
>
0
)
{
pCfgs
=
calloc
(
vnodesNum
,
sizeof
(
SWrapperCfg
));
if
(
pCfgs
==
NULL
)
{
dError
(
"failed to read %s since out of memory"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfgs
=
calloc
(
vnodesNum
,
sizeof
(
SWrapperCfg
));
if
(
pCfgs
==
NULL
)
{
dError
(
"failed to read %s since out of memory"
,
file
);
goto
PRASE_VNODE_OVER
;
}
for
(
int32_t
i
=
0
;
i
<
vnodesNum
;
++
i
)
{
cJSON
*
vnode
=
cJSON_GetArrayItem
(
vnodes
,
i
);
SWrapperCfg
*
pCfg
=
&
pCfgs
[
i
];
for
(
int32_t
i
=
0
;
i
<
vnodesNum
;
++
i
)
{
cJSON
*
vnode
=
cJSON_GetArrayItem
(
vnodes
,
i
);
SWrapperCfg
*
pCfg
=
&
pCfgs
[
i
];
cJSON
*
vgId
=
cJSON_GetObjectItem
(
vnode
,
"vgId"
);
if
(
!
vgId
||
vgId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgId not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgId
=
vgId
->
valueint
;
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s/vnode%d"
,
pDnode
->
dir
.
vnodes
,
pCfg
->
vgId
);
cJSON
*
vgId
=
cJSON_GetObjectItem
(
vnode
,
"vgId"
);
if
(
!
vgId
||
vgId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgId not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgId
=
vgId
->
valueint
;
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s/vnode%d"
,
pDnode
->
dir
.
vnodes
,
pCfg
->
vgId
);
cJSON
*
dropped
=
cJSON_GetObjectItem
(
vnode
,
"dropped"
);
if
(
!
dropped
||
dropped
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since dropped not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
dropped
=
dropped
->
valueint
;
cJSON
*
dropped
=
cJSON_GetObjectItem
(
vnode
,
"dropped
"
);
if
(
!
dropped
||
dropped
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since dropped
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
dropped
=
dropped
->
valueint
;
cJSON
*
vgVersion
=
cJSON_GetObjectItem
(
vnode
,
"vgVersion
"
);
if
(
!
vgVersion
||
vgVersion
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgVersion
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgVersion
=
vgVersion
->
valueint
;
cJSON
*
vgVersion
=
cJSON_GetObjectItem
(
vnode
,
"vgVersion
"
);
if
(
!
vgVersion
||
vgVersion
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgVersion
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgVersion
=
vgVersion
->
valueint
;
cJSON
*
dbUid
=
cJSON_GetObjectItem
(
vnode
,
"dbUid
"
);
if
(
!
dbUid
||
dbUid
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since dbUid
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
dbUid
=
atoll
(
dbUid
->
valuestring
)
;
cJSON
*
dbUid
=
cJSON_GetObjectItem
(
vnode
,
"dbUid"
);
if
(
!
dbUid
||
dbUid
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since dbUid not found"
,
file
);
goto
PRASE_VNODE_OVER
;
cJSON
*
db
=
cJSON_GetObjectItem
(
vnode
,
"db"
);
if
(
!
db
||
db
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since db not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
tstrncpy
(
pCfg
->
db
,
db
->
valuestring
,
TSDB_DB_FNAME_LEN
);
}
pCfg
->
dbUid
=
atoll
(
dbUid
->
valuestring
);
cJSON
*
db
=
cJSON_GetObjectItem
(
vnode
,
"db"
);
if
(
!
db
||
db
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since db not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
tstrncpy
(
pCfg
->
db
,
db
->
valuestring
,
TSDB_DB_FNAME_LEN
);
*
ppCfgs
=
pCfgs
;
}
*
ppCfgs
=
pCfgs
;
*
numOfVnodes
=
vnodesNum
;
code
=
0
;
dInfo
(
"succcessed to read file %s"
,
file
);
...
...
@@ -545,13 +545,13 @@ static void dndGenerateWrapperCfg(SDnode *pDnode, SCreateVnodeReq *pCreate, SWra
pCfg
->
vgVersion
=
pCreate
->
vgVersion
;
}
static
SDropVnodeReq
*
vnode
ParseDropVnodeReq
(
SRpcMsg
*
pReq
)
{
static
SDropVnodeReq
*
dnd
ParseDropVnodeReq
(
SRpcMsg
*
pReq
)
{
SDropVnodeReq
*
pDrop
=
pReq
->
pCont
;
pDrop
->
vgId
=
htonl
(
pDrop
->
vgId
);
return
pDrop
;
}
static
SAuthVnodeReq
*
vnode
ParseAuthVnodeReq
(
SRpcMsg
*
pReq
)
{
static
SAuthVnodeReq
*
dnd
ParseAuthVnodeReq
(
SRpcMsg
*
pReq
)
{
SAuthVnodeReq
*
pAuth
=
pReq
->
pCont
;
pAuth
->
vgId
=
htonl
(
pAuth
->
vgId
);
return
pAuth
;
...
...
@@ -569,10 +569,10 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
pCreate
->
vgId
);
if
(
pVnode
!=
NULL
)
{
dDebug
(
"vgId:%d, already exist
, return success
"
,
pCreate
->
vgId
);
dDebug
(
"vgId:%d, already exist"
,
pCreate
->
vgId
);
dndReleaseVnode
(
pDnode
,
pVnode
);
terrno
=
TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED
;
return
0
;
return
-
1
;
}
SVnode
*
pImpl
=
vnodeOpen
(
wrapperCfg
.
path
,
NULL
/*pCfg*/
,
pCreate
->
vgId
);
...
...
@@ -638,7 +638,7 @@ int32_t dndProcessAlterVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessDropVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDropVnodeReq
*
pDrop
=
vnode
ParseDropVnodeReq
(
pReq
);
SDropVnodeReq
*
pDrop
=
dnd
ParseDropVnodeReq
(
pReq
);
int32_t
vgId
=
pDrop
->
vgId
;
dDebug
(
"vgId:%d, drop vnode req is received"
,
vgId
);
...
...
@@ -646,7 +646,8 @@ int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
vgId
);
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to drop since %s"
,
vgId
,
terrstr
());
return
0
;
terrno
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
return
-
1
;
}
pVnode
->
dropped
=
1
;
...
...
@@ -665,7 +666,7 @@ int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessAuthVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SAuthVnodeReq
*
pAuth
=
(
SAuthVnodeReq
*
)
vnode
ParseAuthVnodeReq
(
pReq
);
SAuthVnodeReq
*
pAuth
=
(
SAuthVnodeReq
*
)
dnd
ParseAuthVnodeReq
(
pReq
);
int32_t
vgId
=
pAuth
->
vgId
;
dDebug
(
"vgId:%d, auth vnode req is received"
,
vgId
);
...
...
@@ -682,7 +683,7 @@ int32_t dndProcessAuthVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessSyncVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SSyncVnodeReq
*
pSync
=
(
SSyncVnodeReq
*
)
vnode
ParseDropVnodeReq
(
pReq
);
SSyncVnodeReq
*
pSync
=
(
SSyncVnodeReq
*
)
dnd
ParseDropVnodeReq
(
pReq
);
int32_t
vgId
=
pSync
->
vgId
;
dDebug
(
"vgId:%d, sync vnode req is received"
,
vgId
);
...
...
@@ -704,7 +705,7 @@ int32_t dndProcessSyncVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessCompactVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SCompactVnodeReq
*
pCompact
=
(
SCompactVnodeReq
*
)
vnode
ParseDropVnodeReq
(
pReq
);
SCompactVnodeReq
*
pCompact
=
(
SCompactVnodeReq
*
)
dnd
ParseDropVnodeReq
(
pReq
);
int32_t
vgId
=
pCompact
->
vgId
;
dDebug
(
"vgId:%d, compact vnode req is received"
,
vgId
);
...
...
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
浏览文件 @
ef05688e
...
...
@@ -13,7 +13,7 @@
class
DndTestMnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/dnode_test_mnode"
,
911
3
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/dnode_test_mnode"
,
911
4
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
source/dnode/mgmt/impl/test/snode/dsnode.cpp
浏览文件 @
ef05688e
...
...
@@ -13,7 +13,7 @@
class
DndTestSnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/dnode_test_snode"
,
911
2
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/dnode_test_snode"
,
911
3
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
source/dnode/mgmt/impl/test/vnode/vnode.cpp
浏览文件 @
ef05688e
/**
* @file db.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module v
group-msg
tests
* @brief DNODE module v
node
tests
* @version 0.1
* @date 2021-12-20
*
...
...
@@ -13,7 +13,7 @@
class
DndTestVnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/dnode_test_vnode"
,
91
50
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/dnode_test_vnode"
,
91
15
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
@@ -57,12 +57,17 @@ TEST_F(DndTestVnode, 01_Create_Restart_Drop_Vnode) {
for
(
int
r
=
0
;
r
<
pReq
->
replica
;
++
r
)
{
SReplica
*
pReplica
=
&
pReq
->
replicas
[
r
];
pReplica
->
id
=
htonl
(
1
);
pReplica
->
port
=
htons
(
9
150
);
pReplica
->
port
=
htons
(
9
527
);
}
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_VNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
if
(
i
==
0
)
{
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED
);
}
}
}
...
...
@@ -97,7 +102,7 @@ TEST_F(DndTestVnode, 01_Create_Restart_Drop_Vnode) {
for
(
int
r
=
0
;
r
<
pReq
->
replica
;
++
r
)
{
SReplica
*
pReplica
=
&
pReq
->
replicas
[
r
];
pReplica
->
id
=
htonl
(
1
);
pReplica
->
port
=
htons
(
9
150
);
pReplica
->
port
=
htons
(
9
527
);
}
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_ALTER_VNODE
,
pReq
,
contLen
);
...
...
@@ -123,7 +128,12 @@ TEST_F(DndTestVnode, 01_Create_Restart_Drop_Vnode) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_VNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
if
(
i
==
0
)
{
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
);
}
}
}
}
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
ef05688e
...
...
@@ -29,14 +29,14 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw);
static
int32_t
mndDbActionInsert
(
SSdb
*
pSdb
,
SDbObj
*
pDb
);
static
int32_t
mndDbActionDelete
(
SSdb
*
pSdb
,
SDbObj
*
pDb
);
static
int32_t
mndDbActionUpdate
(
SSdb
*
pSdb
,
SDbObj
*
pOldDb
,
SDbObj
*
pNewDb
);
static
int32_t
mndProcessCreateDb
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterDb
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropDb
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessUseDb
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessSyncDb
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCompactDb
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetDbMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveDbs
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndProcessCreateDb
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessAlterDb
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropDb
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessUseDb
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessSyncDb
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessCompactDb
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetDbMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveDbs
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextDb
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitDb
(
SMnode
*
pMnode
)
{
...
...
@@ -48,12 +48,12 @@ int32_t mndInitDb(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndDbActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndDbActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_DB
,
mndProcessCreateDb
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_DB
,
mndProcessAlterDb
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_DB
,
mndProcessDropDb
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_USE_DB
,
mndProcessUseDb
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SYNC_DB
,
mndProcessSyncDb
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_COMPACT_DB
,
mndProcessCompactDb
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_DB
,
mndProcessCreateDb
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_DB
,
mndProcessAlterDb
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_DB
,
mndProcessDropDb
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_USE_DB
,
mndProcessUseDb
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SYNC_DB
,
mndProcessSyncDb
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_COMPACT_DB
,
mndProcessCompactDb
Req
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_DB
,
mndGetDbMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_DB
,
mndRetrieveDbs
);
...
...
@@ -471,7 +471,7 @@ CREATE_DB_OVER:
return
code
;
}
static
int32_t
mndProcessCreateDb
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessCreateDb
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCreateDbMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
...
...
@@ -668,7 +668,7 @@ UPDATE_DB_OVER:
return
code
;
}
static
int32_t
mndProcessAlterDb
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessAlterDb
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SAlterDbMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
pAlter
->
totalBlocks
=
htonl
(
pAlter
->
totalBlocks
);
...
...
@@ -832,7 +832,7 @@ DROP_DB_OVER:
return
code
;
}
static
int32_t
mndProcessDropDb
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessDropDb
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SDropDbMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
...
...
@@ -861,7 +861,7 @@ static int32_t mndProcessDropDbMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndProcessUseDb
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessUseDb
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SUseDbMsg
*
pUse
=
pMsg
->
rpcMsg
.
pCont
;
...
...
@@ -929,7 +929,7 @@ static int32_t mndProcessUseDbMsg(SMnodeMsg *pMsg) {
return
0
;
}
static
int32_t
mndProcessSyncDb
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessSyncDb
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SSyncDbMsg
*
pSync
=
pMsg
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pSync
->
db
);
...
...
@@ -942,7 +942,7 @@ static int32_t mndProcessSyncDbMsg(SMnodeMsg *pMsg) {
return
0
;
}
static
int32_t
mndProcessCompactDb
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessCompactDb
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCompactDbMsg
*
pCompact
=
pMsg
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCompact
->
db
);
...
...
@@ -1096,8 +1096,8 @@ char *mnGetDbStr(char *src) {
return
pos
;
}
static
int32_t
mndRetrieveDbs
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
static
int32_t
mndRetrieveDbs
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SDbObj
*
pDb
=
NULL
;
...
...
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
ef05688e
...
...
@@ -13,17 +13,28 @@
class
MndTestDb
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/mnode_test_db"
,
9030
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/mnode_test_db"
,
9030
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9030"
;
static
Testbase
test
;
server2
.
Start
(
"/tmp/mnode_test_db2"
,
fqdn
,
9031
,
firstEp
);
}
static
void
TearDownTestSuite
()
{
server2
.
Stop
();
test
.
Cleanup
();
}
static
Testbase
test
;
static
TestServer
server2
;
public:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
};
Testbase
MndTestDb
::
test
;
Testbase
MndTestDb
::
test
;
TestServer
MndTestDb
::
server2
;
TEST_F
(
MndTestDb
,
01
_ShowDb
)
{
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
...
...
@@ -149,7 +160,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
CheckInt32
(
0
);
// tables
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -177,7 +188,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
CheckInt32
(
0
);
// tables
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -301,4 +312,15 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
EXPECT_STREQ
(
pAddr
->
fqdn
,
"localhost"
);
}
}
{
int32_t
contLen
=
sizeof
(
SDropDbMsg
);
SDropDbMsg
*
pReq
=
(
SDropDbMsg
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d2"
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_DB
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录