Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
510dbc24
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,发现更多精彩内容 >>
未验证
提交
510dbc24
编写于
5月 06, 2023
作者:
S
Shengliang Guan
提交者:
GitHub
5月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21188 from taosdata/FIX/TD-18702-3.0
feat: process split vgroup msg imp
上级
c7d4431b
70d21efe
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
52 deletion
+26
-52
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
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
+3
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+20
-49
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
510dbc24
...
...
@@ -60,7 +60,7 @@ static void vmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
if
(
IsReq
(
pMsg
))
{
if
(
code
!=
0
)
{
if
(
terrno
!=
0
)
code
=
terrno
;
dGError
(
"msg:%p, failed to process since %s, type:%s"
,
pMsg
,
t
errst
r
(
code
),
TMSG_INFO
(
pMsg
->
msgType
));
dGError
(
"msg:%p, failed to process since %s, type:%s"
,
pMsg
,
t
strerro
r
(
code
),
TMSG_INFO
(
pMsg
->
msgType
));
}
vmSendRsp
(
pMsg
,
code
);
}
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
510dbc24
...
...
@@ -118,7 +118,7 @@ typedef enum {
}
ETrnPolicy
;
typedef
enum
{
TRN_EXEC_P
RAR
LLEL
=
0
,
TRN_EXEC_P
ARA
LLEL
=
0
,
TRN_EXEC_SERIAL
=
1
,
}
ETrnExec
;
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
510dbc24
...
...
@@ -76,6 +76,7 @@ void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen);
void
mndTransSetCb
(
STrans
*
pTrans
,
ETrnFunc
startFunc
,
ETrnFunc
stopFunc
,
void
*
param
,
int32_t
paramLen
);
void
mndTransSetDbName
(
STrans
*
pTrans
,
const
char
*
dbname
,
const
char
*
stbname
);
void
mndTransSetSerial
(
STrans
*
pTrans
);
void
mndTransSetParallel
(
STrans
*
pTrans
);
void
mndTransSetOper
(
STrans
*
pTrans
,
EOperType
oper
);
int32_t
mndTrancCheckConflict
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
510dbc24
...
...
@@ -643,7 +643,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
pTrans
->
stage
=
TRN_STAGE_PREPARE
;
pTrans
->
policy
=
policy
;
pTrans
->
conflict
=
conflict
;
pTrans
->
exec
=
TRN_EXEC_P
RAR
LLEL
;
pTrans
->
exec
=
TRN_EXEC_P
ARA
LLEL
;
pTrans
->
createdTime
=
taosGetTimestampMs
();
pTrans
->
redoActions
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
STransAction
));
pTrans
->
undoActions
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
STransAction
));
...
...
@@ -793,6 +793,8 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbname)
void
mndTransSetSerial
(
STrans
*
pTrans
)
{
pTrans
->
exec
=
TRN_EXEC_SERIAL
;
}
void
mndTransSetParallel
(
STrans
*
pTrans
)
{
pTrans
->
exec
=
TRN_EXEC_PARALLEL
;
}
void
mndTransSetOper
(
STrans
*
pTrans
,
EOperType
oper
)
{
pTrans
->
oper
=
oper
;
}
static
int32_t
mndTransSync
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
510dbc24
...
...
@@ -2117,6 +2117,18 @@ static int32_t mndAddAdjustVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans,
return
0
;
}
static
int32_t
mndTransCommitVgStatus
(
STrans
*
pTrans
,
SVgObj
*
pVg
,
ESdbStatus
vgStatus
)
{
SSdbRaw
*
pRaw
=
mndVgroupActionEncode
(
pVg
);
if
(
pRaw
==
NULL
)
goto
_err
;
if
(
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_err
;
(
void
)
sdbSetRawStatus
(
pRaw
,
vgStatus
);
pRaw
=
NULL
;
return
0
;
_err:
sdbFreeRaw
(
pRaw
);
return
-
1
;
}
int32_t
mndSplitVgroup
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
NULL
;
...
...
@@ -2195,28 +2207,16 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro
if
(
pDb
->
cfg
.
replications
!=
newVg1
.
replica
)
{
if
(
mndBuildAlterVgroupAction
(
pMnode
,
pTrans
,
pDb
,
pDb
,
&
newVg1
,
pArray
)
!=
0
)
goto
_OVER
;
}
else
{
pRaw
=
mndVgroupActionEncode
(
&
newVg1
);
if
(
pRaw
==
NULL
)
goto
_OVER
;
if
(
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_OVER
;
(
void
)
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
pRaw
=
NULL
;
if
(
mndTransCommitVgStatus
(
pTrans
,
&
newVg1
,
SDB_STATUS_READY
)
<
0
)
goto
_OVER
;
}
if
(
pDb
->
cfg
.
replications
!=
newVg2
.
replica
)
{
if
(
mndBuildAlterVgroupAction
(
pMnode
,
pTrans
,
pDb
,
pDb
,
&
newVg2
,
pArray
)
!=
0
)
goto
_OVER
;
}
else
{
pRaw
=
mndVgroupActionEncode
(
&
newVg2
);
if
(
pRaw
==
NULL
)
goto
_OVER
;
if
(
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_OVER
;
(
void
)
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
pRaw
=
NULL
;
if
(
mndTransCommitVgStatus
(
pTrans
,
&
newVg2
,
SDB_STATUS_READY
)
<
0
)
goto
_OVER
;
}
pRaw
=
mndVgroupActionEncode
(
pVgroup
);
if
(
pRaw
==
NULL
)
goto
_OVER
;
if
(
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_OVER
;
(
void
)
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_DROPPED
);
pRaw
=
NULL
;
if
(
mndTransCommitVgStatus
(
pTrans
,
pVgroup
,
SDB_STATUS_DROPPED
)
<
0
)
goto
_OVER
;
memcpy
(
&
dbObj
,
pDb
,
sizeof
(
SDbObj
));
if
(
dbObj
.
cfg
.
pRetensions
!=
NULL
)
{
...
...
@@ -2243,42 +2243,13 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessSplitVgroupMsg
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
SVgObj
*
pVgroup
=
NULL
;
SDbObj
*
pDb
=
NULL
;
extern
int32_t
mndProcessSplitVgroupMsgImp
(
SRpcMsg
*
pReq
);
SSplitVgroupReq
req
=
{
0
};
if
(
tDeserializeSSplitVgroupReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
req
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
static
int32_t
mndProcessSplitVgroupMsg
(
SRpcMsg
*
pReq
)
{
return
mndProcessSplitVgroupMsgImp
(
pReq
);
}
mInfo
(
"vgId:%d, start to split"
,
req
.
vgId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_SPLIT_VGROUP
)
!=
0
)
{
goto
_OVER
;
}
pVgroup
=
mndAcquireVgroup
(
pMnode
,
req
.
vgId
);
if
(
pVgroup
==
NULL
)
goto
_OVER
;
pDb
=
mndAcquireDb
(
pMnode
,
pVgroup
->
dbName
);
if
(
pDb
==
NULL
)
goto
_OVER
;
code
=
mndSplitVgroup
(
pMnode
,
pReq
,
pDb
,
pVgroup
);
if
(
code
!=
0
)
{
mError
(
"vgId:%d, failed to start to split vgroup since %s, db:%s"
,
pVgroup
->
vgId
,
terrstr
(),
pDb
->
name
);
goto
_OVER
;
}
mInfo
(
"vgId:%d, split vgroup started successfully. db:%s"
,
pVgroup
->
vgId
,
pDb
->
name
);
_OVER:
mndReleaseVgroup
(
pMnode
,
pVgroup
);
mndReleaseDb
(
pMnode
,
pDb
);
return
code
;
}
#ifndef TD_ENTERPRISE
int32_t
mndProcessSplitVgroupMsgImp
(
SRpcMsg
*
pReq
)
{
return
0
;
}
#endif
static
int32_t
mndSetBalanceVgroupInfoToTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrc
,
SDnodeObj
*
pDst
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录