Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
c224d868
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c224d868
编写于
4月 10, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
4月 10, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5758 from taosdata/fix/TD-3681
[TD-3681]<fix>: fix syncdb precondition checkings
上级
2255f6fc
898cc038
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
11 addition
and
7 deletion
+11
-7
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+1
-0
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+4
-6
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+6
-1
未找到文件。
src/mnode/src/mnodeVgroup.c
浏览文件 @
c224d868
...
@@ -994,6 +994,7 @@ void mnodeSendSyncVgroupMsg(SVgObj *pVgroup) {
...
@@ -994,6 +994,7 @@ void mnodeSendSyncVgroupMsg(SVgObj *pVgroup) {
mDebug
(
"vgId:%d, send sync all vnodes msg, numOfVnodes:%d db:%s"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
mDebug
(
"vgId:%d, send sync all vnodes msg, numOfVnodes:%d db:%s"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
pVgroup
->
dbName
);
pVgroup
->
dbName
);
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
if
(
pVgroup
->
vnodeGid
[
i
].
role
!=
TAOS_SYNC_ROLE_SLAVE
)
continue
;
SRpcEpSet
epSet
=
mnodeGetEpSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
SRpcEpSet
epSet
=
mnodeGetEpSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mDebug
(
"vgId:%d, index:%d, send sync vnode msg to dnode %s"
,
pVgroup
->
vgId
,
i
,
mDebug
(
"vgId:%d, index:%d, send sync vnode msg to dnode %s"
,
pVgroup
->
vgId
,
i
,
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
...
...
src/sync/src/syncMain.c
浏览文件 @
c224d868
...
@@ -409,23 +409,22 @@ void syncConfirmForward(int64_t rid, uint64_t version, int32_t code, bool force)
...
@@ -409,23 +409,22 @@ void syncConfirmForward(int64_t rid, uint64_t version, int32_t code, bool force)
syncReleaseNode
(
pNode
);
syncReleaseNode
(
pNode
);
}
}
#if 1
void
syncRecover
(
int64_t
rid
)
{
void
syncRecover
(
int64_t
rid
)
{
SSyncPeer
*
pPeer
;
SSyncPeer
*
pPeer
;
SSyncNode
*
pNode
=
syncAcquireNode
(
rid
);
SSyncNode
*
pNode
=
syncAcquireNode
(
rid
);
if
(
pNode
==
NULL
)
return
;
if
(
pNode
==
NULL
)
return
;
// to do: add a few lines to check if recover is OK
// if take this node to unsync state, the whole system may not work
nodeRole
=
TAOS_SYNC_ROLE_UNSYNCED
;
nodeRole
=
TAOS_SYNC_ROLE_UNSYNCED
;
(
*
pNode
->
notifyRoleFp
)(
pNode
->
vgId
,
nodeRole
);
(
*
pNode
->
notifyRoleFp
)(
pNode
->
vgId
,
nodeRole
);
nodeVersion
=
0
;
pthread_mutex_lock
(
&
pNode
->
mutex
);
pthread_mutex_lock
(
&
pNode
->
mutex
);
nodeVersion
=
0
;
for
(
int32_t
i
=
0
;
i
<
pNode
->
replica
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pNode
->
replica
;
++
i
)
{
if
(
i
==
pNode
->
selfIndex
)
continue
;
pPeer
=
pNode
->
peerInfo
[
i
];
pPeer
=
pNode
->
peerInfo
[
i
];
if
(
pPeer
->
peerFd
>=
0
)
{
if
(
pPeer
->
peerFd
>=
0
)
{
syncRestartConnection
(
pPeer
);
syncRestartConnection
(
pPeer
);
...
@@ -436,7 +435,6 @@ void syncRecover(int64_t rid) {
...
@@ -436,7 +435,6 @@ void syncRecover(int64_t rid) {
syncReleaseNode
(
pNode
);
syncReleaseNode
(
pNode
);
}
}
#endif
int32_t
syncGetNodesRole
(
int64_t
rid
,
SNodesRole
*
pNodesRole
)
{
int32_t
syncGetNodesRole
(
int64_t
rid
,
SNodesRole
*
pNodesRole
)
{
SSyncNode
*
pNode
=
syncAcquireNode
(
rid
);
SSyncNode
*
pNode
=
syncAcquireNode
(
rid
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
c224d868
...
@@ -99,8 +99,13 @@ int32_t vnodeSync(int32_t vgId) {
...
@@ -99,8 +99,13 @@ int32_t vnodeSync(int32_t vgId) {
return
TSDB_CODE_VND_INVALID_VGROUP_ID
;
return
TSDB_CODE_VND_INVALID_VGROUP_ID
;
}
}
if
(
pVnode
->
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
if
(
pVnode
->
role
==
TAOS_SYNC_ROLE_SLAVE
)
{
vInfo
(
"vgId:%d, vnode will sync, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
vInfo
(
"vgId:%d, vnode will sync, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
pVnode
->
version
=
0
;
pVnode
->
fversion
=
0
;
walResetVersion
(
pVnode
->
wal
,
pVnode
->
fversion
);
syncRecover
(
pVnode
->
sync
);
syncRecover
(
pVnode
->
sync
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录