Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a781d435
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看板
提交
a781d435
编写于
4月 24, 2023
作者:
C
cadem
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix/block-check-to-async-check
上级
03ffbdd4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
50 addition
and
18 deletion
+50
-18
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-0
include/util/taoserror.h
include/util/taoserror.h
+2
-0
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+12
-2
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-0
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-0
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+4
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+28
-16
未找到文件。
include/libs/sync/sync.h
浏览文件 @
a781d435
...
...
@@ -250,6 +250,7 @@ void syncPreStop(int64_t rid);
void
syncPostStop
(
int64_t
rid
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
,
int64_t
*
seq
);
int32_t
syncIsCatchUp
(
int64_t
rid
);
ESyncRole
syncGetRole
(
int64_t
rid
);
int32_t
syncProcessMsg
(
int64_t
rid
,
SRpcMsg
*
pMsg
);
int32_t
syncReconfig
(
int64_t
rid
,
SSyncCfg
*
pCfg
);
int32_t
syncBeginSnapshot
(
int64_t
rid
,
int64_t
lastApplyIndex
);
...
...
include/util/taoserror.h
浏览文件 @
a781d435
...
...
@@ -437,6 +437,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_VND_STOPPED TAOS_DEF_ERROR_CODE(0, 0x0529)
#define TSDB_CODE_VND_DUP_REQUEST TAOS_DEF_ERROR_CODE(0, 0x0530)
#define TSDB_CODE_VND_QUERY_BUSY TAOS_DEF_ERROR_CODE(0, 0x0531)
#define TSDB_CODE_VND_NOT_CATCH_UP TAOS_DEF_ERROR_CODE(0, 0x0532) // internal
#define TSDB_CODE_VND_ALREADY_IS_VOTER TAOS_DEF_ERROR_CODE(0, 0x0533) // internal
// tsdb
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
a781d435
...
...
@@ -336,13 +336,21 @@ int32_t vmProcessAlterVnodeTypeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
req
.
vgId
);
if
(
pVnode
==
NULL
)
{
dError
(
"vgId:%d, failed to alter
hashrang
e since %s"
,
req
.
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to alter
vnode typ
e since %s"
,
req
.
vgId
,
terrstr
());
terrno
=
TSDB_CODE_VND_NOT_EXIST
;
return
-
1
;
}
if
(
vnodeGetRole
(
pVnode
->
pImpl
)
==
TAOS_SYNC_ROLE_VOTER
){
terrno
=
TSDB_CODE_VND_ALREADY_IS_VOTER
;
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
}
dInfo
(
"vgId:%d, checking node catch up"
,
req
.
vgId
);
if
(
vnodeIsCatchUp
(
pVnode
->
pImpl
)
!=
0
){
if
(
vnodeIsCatchUp
(
pVnode
->
pImpl
)
!=
1
){
terrno
=
TSDB_CODE_VND_NOT_CATCH_UP
;
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
}
...
...
@@ -365,6 +373,7 @@ int32_t vmProcessAlterVnodeTypeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
req
.
selfIndex
>=
req
.
replica
||
req
.
learnerSelfIndex
>=
req
.
learnerReplica
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
dError
(
"vgId:%d, failed to alter replica since invalid msg"
,
vgId
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
}
...
...
@@ -381,6 +390,7 @@ int32_t vmProcessAlterVnodeTypeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
terrno
=
TSDB_CODE_INVALID_MSG
;
dError
(
"vgId:%d, dnodeId:%d ep:%s:%u not matched with local dnode"
,
vgId
,
pReplica
->
id
,
pReplica
->
fqdn
,
pReplica
->
port
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
a781d435
...
...
@@ -1263,6 +1263,8 @@ int32_t mndAddAlterVnodeTypeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_ALTER_VNODE_TYPE
;
action
.
acceptableCode
=
TSDB_CODE_VND_ALREADY_IS_VOTER
;
action
.
retryCode
=
TSDB_CODE_VND_NOT_CATCH_UP
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
a781d435
...
...
@@ -69,6 +69,7 @@ void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId);
int32_t
vnodeProcessCreateTSma
(
SVnode
*
pVnode
,
void
*
pCont
,
uint32_t
contLen
);
int32_t
vnodeGetAllTableList
(
SVnode
*
pVnode
,
uint64_t
uid
,
SArray
*
list
);
int32_t
vnodeIsCatchUp
(
SVnode
*
pVnode
);
ESyncRole
vnodeGetRole
(
SVnode
*
pVnode
);
int32_t
vnodeGetCtbIdList
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
);
int32_t
vnodeGetCtbIdListByFilter
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
,
bool
(
*
filter
)(
void
*
arg
),
void
*
arg
);
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
a781d435
...
...
@@ -431,6 +431,10 @@ int32_t vnodeIsCatchUp(SVnode *pVnode){
return
syncIsCatchUp
(
pVnode
->
sync
);
}
ESyncRole
vnodeGetRole
(
SVnode
*
pVnode
){
return
syncGetRole
(
pVnode
->
sync
);
}
void
vnodeStop
(
SVnode
*
pVnode
)
{}
int64_t
vnodeGetSyncHandle
(
SVnode
*
pVnode
)
{
return
pVnode
->
sync
;
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
a781d435
...
...
@@ -580,25 +580,37 @@ int32_t syncIsCatchUp(int64_t rid) {
return
-
1
;
}
while
(
1
){
if
(
pSyncNode
->
pLogBuf
->
totalIndex
<
0
||
pSyncNode
->
pLogBuf
->
commitIndex
<
0
||
pSyncNode
->
pLogBuf
->
totalIndex
<
pSyncNode
->
pLogBuf
->
commitIndex
||
pSyncNode
->
pLogBuf
->
totalIndex
-
pSyncNode
->
pLogBuf
->
commitIndex
>
SYNC_LEARNER_CATCHUP
){
sInfo
(
"vgId:%d, Not catch up, wait one second, totalIndex:%"
PRId64
" commitIndex:%"
PRId64
" matchIndex:%"
PRId64
,
pSyncNode
->
vgId
,
pSyncNode
->
pLogBuf
->
totalIndex
,
pSyncNode
->
pLogBuf
->
commitIndex
,
pSyncNode
->
pLogBuf
->
matchIndex
);
taosSsleep
(
1
);
}
else
{
sInfo
(
"vgId:%d, Catch up, totalIndex:%"
PRId64
" commitIndex:%"
PRId64
" matchIndex:%"
PRId64
,
pSyncNode
->
vgId
,
pSyncNode
->
pLogBuf
->
totalIndex
,
pSyncNode
->
pLogBuf
->
commitIndex
,
pSyncNode
->
pLogBuf
->
matchIndex
);
break
;
}
int32_t
isCatchUp
=
0
;
if
(
pSyncNode
->
pLogBuf
->
totalIndex
<
0
||
pSyncNode
->
pLogBuf
->
commitIndex
<
0
||
pSyncNode
->
pLogBuf
->
totalIndex
<
pSyncNode
->
pLogBuf
->
commitIndex
||
pSyncNode
->
pLogBuf
->
totalIndex
-
pSyncNode
->
pLogBuf
->
commitIndex
>
SYNC_LEARNER_CATCHUP
){
sInfo
(
"vgId:%d, Not catch up, wait one second, totalIndex:%"
PRId64
" commitIndex:%"
PRId64
" matchIndex:%"
PRId64
,
pSyncNode
->
vgId
,
pSyncNode
->
pLogBuf
->
totalIndex
,
pSyncNode
->
pLogBuf
->
commitIndex
,
pSyncNode
->
pLogBuf
->
matchIndex
);
isCatchUp
=
0
;
}
else
{
sInfo
(
"vgId:%d, Catch up, totalIndex:%"
PRId64
" commitIndex:%"
PRId64
" matchIndex:%"
PRId64
,
pSyncNode
->
vgId
,
pSyncNode
->
pLogBuf
->
totalIndex
,
pSyncNode
->
pLogBuf
->
commitIndex
,
pSyncNode
->
pLogBuf
->
matchIndex
);
isCatchUp
=
1
;
}
syncNodeRelease
(
pSyncNode
);
return
0
;
return
isCatchUp
;
}
ESyncRole
syncGetRole
(
int64_t
rid
)
{
SSyncNode
*
pSyncNode
=
syncNodeAcquire
(
rid
);
if
(
pSyncNode
==
NULL
)
{
sError
(
"sync Node Acquire error since %d"
,
errno
);
return
-
1
;
}
ESyncRole
role
=
pSyncNode
->
raftCfg
.
cfg
.
nodeInfo
[
pSyncNode
->
raftCfg
.
cfg
.
myIndex
].
nodeRole
;
syncNodeRelease
(
pSyncNode
);
return
role
;
}
int32_t
syncNodePropose
(
SSyncNode
*
pSyncNode
,
SRpcMsg
*
pMsg
,
bool
isWeak
,
int64_t
*
seq
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录