Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3316c148
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看板
提交
3316c148
编写于
12月 29, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test cases
上级
90055852
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
49 addition
and
94 deletion
+49
-94
include/common/tmsg.h
include/common/tmsg.h
+5
-21
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+6
-6
source/dnode/mgmt/impl/test/mnode/mnode.cpp
source/dnode/mgmt/impl/test/mnode/mnode.cpp
+8
-8
source/dnode/mgmt/impl/test/stb/stb.cpp
source/dnode/mgmt/impl/test/stb/stb.cpp
+2
-2
source/dnode/mgmt/impl/test/sut/src/server.cpp
source/dnode/mgmt/impl/test/sut/src/server.cpp
+1
-1
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+16
-16
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+5
-37
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+3
-3
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+3
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
3316c148
...
...
@@ -265,19 +265,7 @@ typedef struct {
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
uint64_t
suid
;
int32_t
sverson
;
uint32_t
ttl
;
uint32_t
keep
;
int32_t
numOfTags
;
int32_t
numOfColumns
;
SSchema
pSchema
[];
}
SCreateStbInternalMsg
;
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
uint64_t
suid
;
}
SDropStbInternalMsg
;
}
SVDropStbReq
;
typedef
struct
{
SMsgHead
head
;
...
...
@@ -855,17 +843,13 @@ typedef struct {
typedef
struct
{
int32_t
dnodeId
;
}
S
CreateMnodeMsg
,
S
DropMnodeMsg
;
}
S
MCreateMnodeMsg
,
SMDropMnodeMsg
,
SD
DropMnodeMsg
;
typedef
struct
{
int32_t
dnodeId
;
int8_t
replica
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
}
SCreateMnodeInMsg
,
SAlterMnodeInMsg
;
typedef
struct
{
int32_t
dnodeId
;
}
SDropMnodeInMsg
;
}
SDCreateMnodeMsg
,
SDAlterMnodeMsg
;
typedef
struct
{
int32_t
dnodeId
;
...
...
@@ -1208,13 +1192,13 @@ typedef struct {
char
*
executor
;
int32_t
sqlLen
;
char
*
sql
;
}
S
CreateTopicInternal
Msg
;
}
S
DCreateTopic
Msg
;
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
uint64_t
tuid
;
}
SD
ropTopicInternal
Msg
;
}
SD
DropTopic
Msg
;
typedef
struct
SVCreateTbReq
{
uint64_t
ver
;
// use a general definition
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
3316c148
...
...
@@ -299,7 +299,7 @@ static void dndBuildMnodeOpenOption(SDnode *pDnode, SMnodeOpt *pOption) {
memcpy
(
&
pOption
->
replicas
,
pMgmt
->
replicas
,
sizeof
(
SReplica
)
*
TSDB_MAX_REPLICA
);
}
static
int32_t
dndBuildMnodeOptionFromMsg
(
SDnode
*
pDnode
,
SMnodeOpt
*
pOption
,
S
CreateMnodeIn
Msg
*
pMsg
)
{
static
int32_t
dndBuildMnodeOptionFromMsg
(
SDnode
*
pDnode
,
SMnodeOpt
*
pOption
,
S
DCreateMnode
Msg
*
pMsg
)
{
dndInitMnodeOption
(
pDnode
,
pOption
);
pOption
->
dnodeId
=
dndGetDnodeId
(
pDnode
);
pOption
->
clusterId
=
dndGetClusterId
(
pDnode
);
...
...
@@ -417,8 +417,8 @@ static int32_t dndDropMnode(SDnode *pDnode) {
return
0
;
}
static
S
CreateMnodeIn
Msg
*
dndParseCreateMnodeMsg
(
SRpcMsg
*
pRpcMsg
)
{
S
CreateMnodeIn
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
static
S
DCreateMnode
Msg
*
dndParseCreateMnodeMsg
(
SRpcMsg
*
pRpcMsg
)
{
S
DCreateMnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
for
(
int32_t
i
=
0
;
i
<
pMsg
->
replica
;
++
i
)
{
pMsg
->
replicas
[
i
].
id
=
htonl
(
pMsg
->
replicas
[
i
].
id
);
...
...
@@ -429,7 +429,7 @@ static SCreateMnodeInMsg *dndParseCreateMnodeMsg(SRpcMsg *pRpcMsg) {
}
int32_t
dndProcessCreateMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
S
CreateMnodeIn
Msg
*
pMsg
=
dndParseCreateMnodeMsg
(
pRpcMsg
);
S
DCreateMnode
Msg
*
pMsg
=
dndParseCreateMnodeMsg
(
pRpcMsg
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_ID_INVALID
;
...
...
@@ -445,7 +445,7 @@ int32_t dndProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
int32_t
dndProcessAlterMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
S
AlterMnodeIn
Msg
*
pMsg
=
dndParseCreateMnodeMsg
(
pRpcMsg
);
S
DAlterMnode
Msg
*
pMsg
=
dndParseCreateMnodeMsg
(
pRpcMsg
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_ID_INVALID
;
...
...
@@ -465,7 +465,7 @@ int32_t dndProcessAlterMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
int32_t
dndProcessDropMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
SD
ropMnodeIn
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
SD
DropMnode
Msg
*
pMsg
=
pRpcMsg
->
pCont
;
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
...
...
source/dnode/mgmt/impl/test/mnode/mnode.cpp
浏览文件 @
3316c148
...
...
@@ -72,9 +72,9 @@ TEST_F(DndTestMnode, 01_ShowDnode) {
TEST_F
(
DndTestMnode
,
02
_Create_Mnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SCreateMnodeMsg
);
int32_t
contLen
=
sizeof
(
S
M
CreateMnodeMsg
);
S
CreateMnodeMsg
*
pReq
=
(
S
CreateMnodeMsg
*
)
rpcMallocCont
(
contLen
);
S
MCreateMnodeMsg
*
pReq
=
(
SM
CreateMnodeMsg
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
1
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
...
...
@@ -85,9 +85,9 @@ TEST_F(DndTestMnode, 02_Create_Mnode_Invalid_Id) {
TEST_F
(
DndTestMnode
,
03
_Create_Mnode_Invalid_Id
)
{
{
int32_t
contLen
=
sizeof
(
SCreateMnodeMsg
);
int32_t
contLen
=
sizeof
(
S
M
CreateMnodeMsg
);
S
CreateMnodeMsg
*
pReq
=
(
S
CreateMnodeMsg
*
)
rpcMallocCont
(
contLen
);
S
MCreateMnodeMsg
*
pReq
=
(
SM
CreateMnodeMsg
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
...
...
@@ -117,9 +117,9 @@ TEST_F(DndTestMnode, 04_Create_Mnode) {
{
// create mnode
int32_t
contLen
=
sizeof
(
SCreateMnodeMsg
);
int32_t
contLen
=
sizeof
(
S
M
CreateMnodeMsg
);
S
CreateMnodeMsg
*
pReq
=
(
S
CreateMnodeMsg
*
)
rpcMallocCont
(
contLen
);
S
MCreateMnodeMsg
*
pReq
=
(
SM
CreateMnodeMsg
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
...
...
@@ -144,9 +144,9 @@ TEST_F(DndTestMnode, 04_Create_Mnode) {
{
// drop mnode
int32_t
contLen
=
sizeof
(
SDropMnodeMsg
);
int32_t
contLen
=
sizeof
(
S
M
DropMnodeMsg
);
S
DropMnodeMsg
*
pReq
=
(
S
DropMnodeMsg
*
)
rpcMallocCont
(
contLen
);
S
MDropMnodeMsg
*
pReq
=
(
SM
DropMnodeMsg
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
...
...
source/dnode/mgmt/impl/test/stb/stb.cpp
浏览文件 @
3316c148
...
...
@@ -146,8 +146,8 @@ TEST_F(DndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
}
EXPECT_STREQ
(
pRsp
->
tbFname
,
""
);
EXPECT_STREQ
(
pRsp
->
stbFname
,
"
1.d1.stb
"
);
EXPECT_STREQ
(
pRsp
->
tbFname
,
"
1.d1.stb
"
);
EXPECT_STREQ
(
pRsp
->
stbFname
,
""
);
EXPECT_EQ
(
pRsp
->
numOfColumns
,
2
);
EXPECT_EQ
(
pRsp
->
numOfTags
,
3
);
EXPECT_EQ
(
pRsp
->
precision
,
TSDB_TIME_PRECISION_MILLI
);
...
...
source/dnode/mgmt/impl/test/sut/src/server.cpp
浏览文件 @
3316c148
...
...
@@ -26,7 +26,7 @@ SDnodeOpt TestServer::BuildOption(const char* path, const char* fqdn, uint16_t p
SDnodeOpt
option
=
{
0
};
option
.
sver
=
1
;
option
.
numOfCores
=
1
;
option
.
numOfSupportVnodes
=
1
;
option
.
numOfSupportVnodes
=
1
6
;
option
.
numOfCommitThreads
=
1
;
option
.
statusInterval
=
1
;
option
.
numOfThreadsPerCore
=
1
;
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
3316c148
...
...
@@ -251,7 +251,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
void
*
pIter
=
NULL
;
int32_t
numOfReplicas
=
0
;
S
CreateMnodeIn
Msg
createMsg
=
{
0
};
S
DCreateMnode
Msg
createMsg
=
{
0
};
while
(
1
)
{
SMnodeObj
*
pMObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_MNODE
,
pIter
,
(
void
**
)
&
pMObj
);
...
...
@@ -281,18 +281,18 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
STransAction
action
=
{
0
};
S
AlterMnodeInMsg
*
pMsg
=
malloc
(
sizeof
(
SAlterMnodeIn
Msg
));
S
DAlterMnodeMsg
*
pMsg
=
malloc
(
sizeof
(
SDAlterMnode
Msg
));
if
(
pMsg
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
}
memcpy
(
pMsg
,
&
createMsg
,
sizeof
(
S
AlterMnodeIn
Msg
));
memcpy
(
pMsg
,
&
createMsg
,
sizeof
(
S
DAlterMnode
Msg
));
pMsg
->
dnodeId
=
htonl
(
pMObj
->
id
);
action
.
epSet
=
mndGetDnodeEpset
(
pMObj
->
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
S
AlterMnodeIn
Msg
);
action
.
contLen
=
sizeof
(
S
DAlterMnode
Msg
);
action
.
msgType
=
TDMT_DND_ALTER_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -309,14 +309,14 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
S
CreateMnodeInMsg
*
pMsg
=
malloc
(
sizeof
(
SCreateMnodeIn
Msg
));
S
DCreateMnodeMsg
*
pMsg
=
malloc
(
sizeof
(
SDCreateMnode
Msg
));
if
(
pMsg
==
NULL
)
return
-
1
;
memcpy
(
pMsg
,
&
createMsg
,
sizeof
(
S
AlterMnodeIn
Msg
));
memcpy
(
pMsg
,
&
createMsg
,
sizeof
(
S
DAlterMnode
Msg
));
pMsg
->
dnodeId
=
htonl
(
pObj
->
id
);
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
S
CreateMnodeIn
Msg
);
action
.
contLen
=
sizeof
(
S
DCreateMnode
Msg
);
action
.
msgType
=
TDMT_DND_CREATE_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
pMsg
);
...
...
@@ -327,7 +327,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
return
0
;
}
static
int32_t
mndCreateMnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
SCreateMnodeMsg
*
pCreate
)
{
static
int32_t
mndCreateMnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SDnodeObj
*
pDnode
,
S
M
CreateMnodeMsg
*
pCreate
)
{
SMnodeObj
mnodeObj
=
{
0
};
mnodeObj
.
id
=
pDnode
->
id
;
mnodeObj
.
createdTime
=
taosGetTimestampMs
();
...
...
@@ -370,7 +370,7 @@ CREATE_MNODE_OVER:
static
int32_t
mndProcessCreateMnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCreateMnodeMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
S
M
CreateMnodeMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
...
...
@@ -423,7 +423,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
void
*
pIter
=
NULL
;
int32_t
numOfReplicas
=
0
;
S
AlterMnodeIn
Msg
alterMsg
=
{
0
};
S
DAlterMnode
Msg
alterMsg
=
{
0
};
while
(
1
)
{
SMnodeObj
*
pMObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_MNODE
,
pIter
,
(
void
**
)
&
pMObj
);
...
...
@@ -449,18 +449,18 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
if
(
pMObj
->
id
!=
pObj
->
id
)
{
STransAction
action
=
{
0
};
S
AlterMnodeInMsg
*
pMsg
=
malloc
(
sizeof
(
SAlterMnodeIn
Msg
));
S
DAlterMnodeMsg
*
pMsg
=
malloc
(
sizeof
(
SDAlterMnode
Msg
));
if
(
pMsg
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
}
memcpy
(
pMsg
,
&
alterMsg
,
sizeof
(
S
AlterMnodeIn
Msg
));
memcpy
(
pMsg
,
&
alterMsg
,
sizeof
(
S
DAlterMnode
Msg
));
pMsg
->
dnodeId
=
htonl
(
pMObj
->
id
);
action
.
epSet
=
mndGetDnodeEpset
(
pMObj
->
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
S
AlterMnodeIn
Msg
);
action
.
contLen
=
sizeof
(
S
DAlterMnode
Msg
);
action
.
msgType
=
TDMT_DND_ALTER_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
...
@@ -478,7 +478,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
SD
ropMnodeInMsg
*
pMsg
=
malloc
(
sizeof
(
SDropMnodeIn
Msg
));
SD
DropMnodeMsg
*
pMsg
=
malloc
(
sizeof
(
SDDropMnode
Msg
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -487,7 +487,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SD
ropMnodeIn
Msg
);
action
.
contLen
=
sizeof
(
SD
DropMnode
Msg
);
action
.
msgType
=
TDMT_DND_DROP_MNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
pMsg
);
...
...
@@ -537,7 +537,7 @@ DROP_MNODE_OVER:
static
int32_t
mndProcessDropMnodeReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SDropMnodeMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
S
M
DropMnodeMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
mDebug
(
"mnode:%d, start to drop"
,
pDrop
->
dnodeId
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
3316c148
...
...
@@ -201,7 +201,6 @@ static SDbObj *mndAcquireDbByStb(SMnode *pMnode, char *stbName) {
}
static
void
*
mndBuildCreateStbMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
,
int
*
pContLen
)
{
#if 1
SVCreateTbReq
req
;
void
*
buf
;
int
bsize
;
...
...
@@ -235,43 +234,12 @@ static void *mndBuildCreateStbMsg(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb
*
pContLen
=
sizeof
(
SMsgHead
)
+
bsize
;
return
buf
;
#else
int32_t
totalCols
=
pStb
->
numOfTags
+
pStb
->
numOfColumns
;
int32_t
contLen
=
totalCols
*
sizeof
(
SSchema
)
+
sizeof
(
SCreateStbInternalMsg
);
SCreateStbInternalMsg
*
pCreate
=
calloc
(
1
,
contLen
);
if
(
pCreate
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
pCreate
->
head
.
contLen
=
htonl
(
contLen
);
pCreate
->
head
.
vgId
=
htonl
(
pVgroup
->
vgId
);
memcpy
(
pCreate
->
name
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
);
pCreate
->
suid
=
htobe64
(
pStb
->
uid
);
pCreate
->
sverson
=
htonl
(
pStb
->
version
);
pCreate
->
ttl
=
0
;
pCreate
->
keep
=
0
;
pCreate
->
numOfTags
=
htonl
(
pStb
->
numOfTags
);
pCreate
->
numOfColumns
=
htonl
(
pStb
->
numOfColumns
);
memcpy
(
pCreate
->
pSchema
,
pStb
->
pSchema
,
totalCols
*
sizeof
(
SSchema
));
for
(
int32_t
t
=
0
;
t
<
totalCols
;
++
t
)
{
SSchema
*
pSchema
=
&
pCreate
->
pSchema
[
t
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
pSchema
->
colId
=
htonl
(
pSchema
->
colId
);
}
*
pContLen
=
contLen
;
return
pCreate
;
#endif
}
static
S
DropStbInternalMsg
*
mndBuildDropStbMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
)
{
int32_t
contLen
=
sizeof
(
S
DropStbInternalMsg
);
static
S
VDropStbReq
*
mndBuildDropStbMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
)
{
int32_t
contLen
=
sizeof
(
S
VDropStbReq
);
S
DropStbInternalMsg
*
pDrop
=
calloc
(
1
,
contLen
);
S
VDropStbReq
*
pDrop
=
calloc
(
1
,
contLen
);
if
(
pDrop
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -402,7 +370,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
!=
pDb
->
uid
)
continue
;
S
DropStbInternalMsg
*
pMsg
=
mndBuildDropStbMsg
(
pMnode
,
pVgroup
,
pStb
);
S
VDropStbReq
*
pMsg
=
mndBuildDropStbMsg
(
pMnode
,
pVgroup
,
pStb
);
if
(
pMsg
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
...
...
@@ -413,7 +381,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
S
DropStbInternalMsg
);
action
.
contLen
=
sizeof
(
S
VDropStbReq
);
action
.
msgType
=
TDMT_VND_DROP_STB
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
pMsg
);
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
3316c148
...
...
@@ -162,10 +162,10 @@ static SDbObj *mndAcquireDbByTopic(SMnode *pMnode, char *topicName) {
return
mndAcquireDb
(
pMnode
,
db
);
}
static
SD
ropTopicInternal
Msg
*
mndBuildDropTopicMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
STopicObj
*
pTopic
)
{
int32_t
contLen
=
sizeof
(
SD
ropTopicInternal
Msg
);
static
SD
DropTopic
Msg
*
mndBuildDropTopicMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
STopicObj
*
pTopic
)
{
int32_t
contLen
=
sizeof
(
SD
DropTopic
Msg
);
SD
ropTopicInternal
Msg
*
pDrop
=
calloc
(
1
,
contLen
);
SD
DropTopic
Msg
*
pDrop
=
calloc
(
1
,
contLen
);
if
(
pDrop
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
3316c148
...
...
@@ -120,6 +120,9 @@ SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
for
(
int8_t
i
=
0
;
i
<
pVgroup
->
replica
;
++
i
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pVgid
->
dnodeId
)
if
(
pVgroup
->
replica
==
1
)
{
pVgid
->
role
=
TAOS_SYNC_STATE_LEADER
;
}
}
SDB_GET_RESERVE
(
pRaw
,
pRow
,
dataPos
,
TSDB_VGROUP_RESERVE_SIZE
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录