Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5d63f438
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5d63f438
编写于
5月 04, 2023
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: confirm alter hash range
上级
67eac1a7
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
33 addition
and
5 deletion
+33
-5
include/common/tmsgdef.h
include/common/tmsgdef.h
+0
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+5
-0
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-0
source/dnode/vnode/src/vnd/vnodeCfg.c
source/dnode/vnode/src/vnd/vnodeCfg.c
+3
-0
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+1
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+22
-3
未找到文件。
include/common/tmsgdef.h
浏览文件 @
5d63f438
...
...
@@ -225,7 +225,6 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_COMMIT
,
"vnode-commit"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CREATE_INDEX
,
"vnode-create-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_INDEX
,
"vnode-drop-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DISABLE_WRITE
,
"vnode-disable-write"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MAX_MSG
,
"vnd-max"
,
NULL
,
NULL
)
...
...
source/common/src/tmsg.c
浏览文件 @
5d63f438
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
5d63f438
...
...
@@ -2164,6 +2164,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
mInfo
(
"vgId:%d, vnode:%d dnode:%d"
,
newVg2
.
vgId
,
i
,
newVg2
.
vnodeGid
[
i
].
dnodeId
);
}
// alter hash range
int32_t
maxVgId
=
sdbGetMaxId
(
pMnode
->
pSdb
,
SDB_VGROUP
);
if
(
mndAddAlterVnodeHashRangeAction
(
pMnode
,
pTrans
,
&
newVg1
,
maxVgId
)
!=
0
)
goto
_OVER
;
newVg1
.
vgId
=
maxVgId
;
...
...
@@ -2172,6 +2173,10 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
if
(
mndAddAlterVnodeHashRangeAction
(
pMnode
,
pTrans
,
&
newVg2
,
maxVgId
)
!=
0
)
goto
_OVER
;
newVg2
.
vgId
=
maxVgId
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg2
)
!=
0
)
goto
_OVER
;
// adjust vgroup replica
if
(
pDb
->
cfg
.
replications
!=
newVg1
.
replica
)
{
if
(
mndBuildAlterVgroupAction
(
pMnode
,
pTrans
,
pDb
,
pDb
,
&
newVg1
,
pArray
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
5d63f438
...
...
@@ -343,6 +343,7 @@ struct SVnodeCfg {
SVnodeStats
vndStats
;
uint32_t
hashBegin
;
uint32_t
hashEnd
;
bool
hashChange
;
int16_t
sttTrigger
;
int16_t
hashPrefix
;
int16_t
hashSuffix
;
...
...
source/dnode/vnode/src/vnd/vnodeCfg.c
浏览文件 @
5d63f438
...
...
@@ -134,6 +134,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
if
(
tjsonAddIntegerToObject
(
pJson
,
"sstTrigger"
,
pCfg
->
sttTrigger
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashBegin"
,
pCfg
->
hashBegin
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashEnd"
,
pCfg
->
hashEnd
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashChange"
,
pCfg
->
hashChange
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashMethod"
,
pCfg
->
hashMethod
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashPrefix"
,
pCfg
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashSuffix"
,
pCfg
->
hashSuffix
)
<
0
)
return
-
1
;
...
...
@@ -249,6 +250,8 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"hashEnd"
,
pCfg
->
hashEnd
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"hashChange"
,
pCfg
->
hashChange
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"hashMethod"
,
pCfg
->
hashMethod
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"hashPrefix"
,
pCfg
->
hashPrefix
,
code
);
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
5d63f438
...
...
@@ -198,6 +198,7 @@ int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnod
info
.
config
.
vgId
=
pReq
->
dstVgId
;
info
.
config
.
hashBegin
=
pReq
->
hashBegin
;
info
.
config
.
hashEnd
=
pReq
->
hashEnd
;
info
.
config
.
hashChange
=
true
;
info
.
config
.
walCfg
.
vgId
=
pReq
->
dstVgId
;
SSyncCfg
*
pCfg
=
&
info
.
config
.
syncCfg
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
5d63f438
...
...
@@ -1453,11 +1453,30 @@ int32_t vnodeProcessCreateTSma(SVnode *pVnode, void *pCont, uint32_t contLen) {
return
vnodeProcessCreateTSmaReq
(
pVnode
,
1
,
pCont
,
contLen
,
NULL
);
}
static
int32_t
vnodeConsolidateAlterHashRange
(
SVnode
*
pVnode
,
int64_t
version
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
vInfo
(
"vgId:%d, trim meta of tables per hash range [%"
PRIu32
", %"
PRIu32
"]. apply-index:%"
PRId64
,
TD_VID
(
pVnode
),
pVnode
->
config
.
hashBegin
,
pVnode
->
config
.
hashEnd
,
version
);
// TODO: trim meta of tables from TDB per hash range [pVnode->config.hashBegin, pVnode->config.hashEnd]
return
code
;
}
static
int32_t
vnodeProcessAlterConfirmReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
vInfo
(
"vgId:%d, vnode management handle msgType:alter-confirm, alter replica confim msg is processed"
,
TD_VID
(
pVnode
));
vInfo
(
"vgId:%d, vnode handle msgType:alter-confirm, alter confim msg is processed"
,
TD_VID
(
pVnode
));
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
!
pVnode
->
config
.
hashChange
)
{
goto
_exit
;
}
code
=
vnodeConsolidateAlterHashRange
(
pVnode
,
version
);
pVnode
->
config
.
hashChange
=
false
;
_exit:
pRsp
->
msgType
=
TDMT_VND_ALTER_CONFIRM_RSP
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
pRsp
->
code
=
code
;
pRsp
->
pCont
=
NULL
;
pRsp
->
contLen
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录