Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d23d223f
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d23d223f
编写于
1月 09, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
e0e4c504
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
55 addition
and
33 deletion
+55
-33
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
+3
-3
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
未找到文件。
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
浏览文件 @
d23d223f
...
...
@@ -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
浏览文件 @
d23d223f
...
...
@@ -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
浏览文件 @
d23d223f
...
...
@@ -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,7 +57,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_CREATE_VNODE
,
pReq
,
contLen
);
...
...
@@ -102,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
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
d23d223f
...
...
@@ -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
浏览文件 @
d23d223f
...
...
@@ -13,10 +13,20 @@
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"
;
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
{}
...
...
@@ -24,6 +34,7 @@ class MndTestDb : public ::testing::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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录