Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3573ae15
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
3573ae15
编写于
6月 20, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(sync): block when changing
上级
e441bd26
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
152 addition
and
179 deletion
+152
-179
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+1
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+148
-142
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+3
-36
未找到文件。
source/libs/sync/inc/syncInt.h
浏览文件 @
3573ae15
...
...
@@ -199,7 +199,7 @@ char* syncNode2Str(const SSyncNode* pSyncNode);
void
syncNodeEventLog
(
const
SSyncNode
*
pSyncNode
,
char
*
str
);
char
*
syncNode2SimpleStr
(
const
SSyncNode
*
pSyncNode
);
bool
syncNodeInConfig
(
SSyncNode
*
pSyncNode
,
const
SSyncCfg
*
config
);
void
syncNodeDoConfigChange
(
SSyncNode
*
pSyncNode
,
SSyncCfg
*
newConfig
,
SyncIndex
lastConfigChangeIndex
,
bool
*
isDrop
);
void
syncNodeDoConfigChange
(
SSyncNode
*
pSyncNode
,
SSyncCfg
*
newConfig
,
SyncIndex
lastConfigChangeIndex
);
SSyncNode
*
syncNodeAcquire
(
int64_t
rid
);
void
syncNodeRelease
(
SSyncNode
*
pNode
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
3573ae15
...
...
@@ -1366,146 +1366,188 @@ bool syncNodeInConfig(SSyncNode* pSyncNode, const SSyncCfg* config) {
return
b1
;
}
void
syncNodeDoConfigChange
(
SSyncNode
*
pSyncNode
,
SSyncCfg
*
pNewConfig
,
SyncIndex
lastConfigChangeIndex
,
bool
*
isDrop
)
{
void
syncNodeDoConfigChange
(
SSyncNode
*
pSyncNode
,
SSyncCfg
*
pNewConfig
,
SyncIndex
lastConfigChangeIndex
)
{
SSyncCfg
oldConfig
=
pSyncNode
->
pRaftCfg
->
cfg
;
pSyncNode
->
pRaftCfg
->
cfg
=
*
pNewConfig
;
pSyncNode
->
pRaftCfg
->
lastConfigIndex
=
lastConfigChangeIndex
;
int32_t
ret
=
0
;
bool
IamInOld
=
syncNodeInConfig
(
pSyncNode
,
&
oldConfig
);
bool
IamInNew
=
syncNodeInConfig
(
pSyncNode
,
pNewConfig
);
// save snapshot senders
int32_t
oldReplicaNum
=
pSyncNode
->
replicaNum
;
SRaftId
oldReplicasId
[
TSDB_MAX_REPLICA
];
memcpy
(
oldReplicasId
,
pSyncNode
->
replicasId
,
sizeof
(
oldReplicasId
));
SSyncSnapshotSender
*
oldSenders
[
TSDB_MAX_REPLICA
];
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
oldSenders
[
i
]
=
(
pSyncNode
->
senders
)[
i
];
bool
isDrop
=
false
;
bool
isAdd
=
false
;
char
*
eventLog
=
snapshotSender2SimpleStr
(
oldSenders
[
i
],
"snapshot sender save old"
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
taosMemoryFree
(
eventLog
);
if
(
IamInOld
&&
!
IamInNew
)
{
isDrop
=
true
;
}
else
{
isDrop
=
false
;
}
// init internal
pSyncNode
->
myNodeInfo
=
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
];
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
myNodeInfo
,
pSyncNode
->
vgId
,
&
pSyncNode
->
myRaftId
);
if
(
!
IamInOld
&&
IamInNew
)
{
isAdd
=
true
;
}
else
{
isAdd
=
false
;
}
// init peersNum, peers, peersId
pSyncNode
->
peersNum
=
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
-
1
;
int
j
=
0
;
for
(
int
i
=
0
;
i
<
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
++
i
)
{
if
(
i
!=
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
)
{
pSyncNode
->
peersNodeInfo
[
j
]
=
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
i
];
j
++
;
}
if
(
IamInNew
)
{
pSyncNode
->
pRaftCfg
->
isStandBy
=
0
;
// change isStandBy to normal
}
for
(
int
i
=
0
;
i
<
pSyncNode
->
peersNum
;
++
i
)
{
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
peersNodeInfo
[
i
],
pSyncNode
->
vgId
,
&
pSyncNode
->
peersId
[
i
]);
if
(
isDrop
)
{
pSyncNode
->
pRaftCfg
->
isStandBy
=
1
;
// set standby
}
// init replicaNum, replicasId
pSyncNode
->
replicaNum
=
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
for
(
int
i
=
0
;
i
<
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
++
i
)
{
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
i
],
pSyncNode
->
vgId
,
&
pSyncNode
->
replicasId
[
i
]);
}
// persist last config index
raftCfgAddConfigIndex
(
pSyncNode
->
pRaftCfg
,
lastConfigChangeIndex
);
syncIndexMgrUpdate
(
pSyncNode
->
pNextIndex
,
pSyncNode
);
syncIndexMgrUpdate
(
pSyncNode
->
pMatchIndex
,
pSyncNode
);
voteGrantedUpdate
(
pSyncNode
->
pVotesGranted
,
pSyncNode
);
votesRespondUpdate
(
pSyncNode
->
pVotesRespond
,
pSyncNode
);
if
(
IamInNew
)
{
//-----------------------------------------
int32_t
ret
=
0
;
// save snapshot senders
int32_t
oldReplicaNum
=
pSyncNode
->
replicaNum
;
SRaftId
oldReplicasId
[
TSDB_MAX_REPLICA
];
memcpy
(
oldReplicasId
,
pSyncNode
->
replicasId
,
sizeof
(
oldReplicasId
));
SSyncSnapshotSender
*
oldSenders
[
TSDB_MAX_REPLICA
];
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
oldSenders
[
i
]
=
(
pSyncNode
->
senders
)[
i
];
pSyncNode
->
quorum
=
syncUtilQuorum
(
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
);
char
*
eventLog
=
snapshotSender2SimpleStr
(
oldSenders
[
i
],
"snapshot sender save old"
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
taosMemoryFree
(
eventLog
);
}
// reset snapshot senders
// init internal
pSyncNode
->
myNodeInfo
=
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
];
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
myNodeInfo
,
pSyncNode
->
vgId
,
&
pSyncNode
->
myRaftId
);
// init peersNum, peers, peersId
pSyncNode
->
peersNum
=
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
-
1
;
int
j
=
0
;
for
(
int
i
=
0
;
i
<
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
++
i
)
{
if
(
i
!=
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
)
{
pSyncNode
->
peersNodeInfo
[
j
]
=
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
i
];
j
++
;
}
}
for
(
int
i
=
0
;
i
<
pSyncNode
->
peersNum
;
++
i
)
{
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
peersNodeInfo
[
i
],
pSyncNode
->
vgId
,
&
pSyncNode
->
peersId
[
i
]);
}
// clear new
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
(
pSyncNode
->
senders
)[
i
]
=
NULL
;
}
// init replicaNum, replicasId
pSyncNode
->
replicaNum
=
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
for
(
int
i
=
0
;
i
<
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
++
i
)
{
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
i
],
pSyncNode
->
vgId
,
&
pSyncNode
->
replicasId
[
i
]);
}
// reset new
for
(
int
i
=
0
;
i
<
pSyncNode
->
replicaNum
;
++
i
)
{
// reset sender
bool
reset
=
false
;
for
(
int
j
=
0
;
j
<
TSDB_MAX_REPLICA
;
++
j
)
{
if
(
syncUtilSameId
(
&
(
pSyncNode
->
replicasId
)[
i
],
&
oldReplicasId
[
j
]))
{
char
host
[
128
];
uint16_t
port
;
syncUtilU642Addr
((
pSyncNode
->
replicasId
)[
i
].
addr
,
host
,
sizeof
(
host
),
&
port
);
syncIndexMgrUpdate
(
pSyncNode
->
pNextIndex
,
pSyncNode
);
syncIndexMgrUpdate
(
pSyncNode
->
pMatchIndex
,
pSyncNode
);
voteGrantedUpdate
(
pSyncNode
->
pVotesGranted
,
pSyncNode
);
votesRespondUpdate
(
pSyncNode
->
pVotesRespond
,
pSyncNode
);
do
{
char
eventLog
[
256
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender reset for %lu, newIndex:%d, %s:%d, %p"
,
(
pSyncNode
->
replicasId
)[
i
].
addr
,
i
,
host
,
port
,
oldSenders
[
j
]);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
}
while
(
0
);
pSyncNode
->
quorum
=
syncUtilQuorum
(
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
);
(
pSyncNode
->
senders
)[
i
]
=
oldSenders
[
j
];
oldSenders
[
j
]
=
NULL
;
reset
=
true
;
// reset snapshot senders
// reset replicaIndex
int32_t
oldreplicaIndex
=
(
pSyncNode
->
senders
)[
i
]
->
replicaIndex
;
(
pSyncNode
->
senders
)[
i
]
->
replicaIndex
=
i
;
// clear new
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
(
pSyncNode
->
senders
)[
i
]
=
NULL
;
}
do
{
char
eventLog
[
256
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender udpate replicaIndex from %d to %d, %s:%d, %p, reset:%d"
,
oldreplicaIndex
,
i
,
host
,
port
,
(
pSyncNode
->
senders
)[
i
],
reset
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
}
while
(
0
);
// reset new
for
(
int
i
=
0
;
i
<
pSyncNode
->
replicaNum
;
++
i
)
{
// reset sender
bool
reset
=
false
;
for
(
int
j
=
0
;
j
<
TSDB_MAX_REPLICA
;
++
j
)
{
if
(
syncUtilSameId
(
&
(
pSyncNode
->
replicasId
)[
i
],
&
oldReplicasId
[
j
]))
{
char
host
[
128
];
uint16_t
port
;
syncUtilU642Addr
((
pSyncNode
->
replicasId
)[
i
].
addr
,
host
,
sizeof
(
host
),
&
port
);
do
{
char
eventLog
[
256
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender reset for %lu, newIndex:%d, %s:%d, %p"
,
(
pSyncNode
->
replicasId
)[
i
].
addr
,
i
,
host
,
port
,
oldSenders
[
j
]);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
}
while
(
0
);
(
pSyncNode
->
senders
)[
i
]
=
oldSenders
[
j
];
oldSenders
[
j
]
=
NULL
;
reset
=
true
;
// reset replicaIndex
int32_t
oldreplicaIndex
=
(
pSyncNode
->
senders
)[
i
]
->
replicaIndex
;
(
pSyncNode
->
senders
)[
i
]
->
replicaIndex
=
i
;
do
{
char
eventLog
[
256
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender udpate replicaIndex from %d to %d, %s:%d, %p, reset:%d"
,
oldreplicaIndex
,
i
,
host
,
port
,
(
pSyncNode
->
senders
)[
i
],
reset
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
}
while
(
0
);
}
}
}
}
// create new
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
if
((
pSyncNode
->
senders
)[
i
]
==
NULL
)
{
(
pSyncNode
->
senders
)[
i
]
=
snapshotSenderCreate
(
pSyncNode
,
i
);
// create new
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
if
((
pSyncNode
->
senders
)[
i
]
==
NULL
)
{
(
pSyncNode
->
senders
)[
i
]
=
snapshotSenderCreate
(
pSyncNode
,
i
);
char
*
eventLog
=
snapshotSender2SimpleStr
((
pSyncNode
->
senders
)[
i
],
"snapshot sender create new"
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
taosMemoryFree
(
eventLog
);
char
*
eventLog
=
snapshotSender2SimpleStr
((
pSyncNode
->
senders
)[
i
],
"snapshot sender create new"
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
taosMemoryFree
(
eventLog
);
}
}
}
// free old
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
if
(
oldSenders
[
i
]
!=
NULL
)
{
snapshotSenderDestroy
(
oldSenders
[
i
]);
// free old
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
if
(
oldSenders
[
i
]
!=
NULL
)
{
snapshotSenderDestroy
(
oldSenders
[
i
]);
do
{
char
eventLog
[
128
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender delete old %p replica-index:%d"
,
oldSenders
[
i
],
i
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
}
while
(
0
);
do
{
char
eventLog
[
128
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender delete old %p replica-index:%d"
,
oldSenders
[
i
],
i
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
}
while
(
0
);
oldSenders
[
i
]
=
NULL
;
oldSenders
[
i
]
=
NULL
;
}
}
}
bool
IamInOld
=
syncNodeInConfig
(
pSyncNode
,
&
oldConfig
);
bool
IamInNew
=
syncNodeInConfig
(
pSyncNode
,
pNewConfi
g
);
// persist
raftCfgPersist
(
pSyncNode
->
pRaftCf
g
);
*
isDrop
=
true
;
if
(
IamInOld
&&
!
IamInNew
)
{
*
isDrop
=
true
;
}
else
{
*
isDrop
=
false
;
}
char
tmpbuf
[
512
];
char
*
oldStr
=
syncCfg2SimpleStr
(
&
oldConfig
);
char
*
newStr
=
syncCfg2SimpleStr
(
pNewConfig
);
snprintf
(
tmpbuf
,
sizeof
(
tmpbuf
),
"config change from %d to %d, index:%ld, %s --> %s"
,
oldConfig
.
replicaNum
,
pNewConfig
->
replicaNum
,
lastConfigChangeIndex
,
oldStr
,
newStr
);
taosMemoryFree
(
oldStr
);
taosMemoryFree
(
newStr
);
// may be add me to a new raft group
if
(
IamInOld
&&
IamInNew
&&
oldConfig
.
replicaNum
==
1
)
{
}
// change isStandBy to normal (election timeout)
if
(
pSyncNode
->
state
==
TAOS_SYNC_STATE_LEADER
)
{
syncNodeBecomeLeader
(
pSyncNode
,
tmpbuf
);
}
else
{
syncNodeBecomeFollower
(
pSyncNode
,
tmpbuf
);
}
}
else
{
// persist
raftCfgPersist
(
pSyncNode
->
pRaftCfg
);
if
(
IamInNew
)
{
pSyncNode
->
pRaftCfg
->
isStandBy
=
0
;
// change isStandBy to normal
char
tmpbuf
[
512
];
char
*
oldStr
=
syncCfg2SimpleStr
(
&
oldConfig
);
char
*
newStr
=
syncCfg2SimpleStr
(
pNewConfig
);
snprintf
(
tmpbuf
,
sizeof
(
tmpbuf
),
"do not config change from %d to %d, index:%ld, %s --> %s"
,
oldConfig
.
replicaNum
,
pNewConfig
->
replicaNum
,
lastConfigChangeIndex
,
oldStr
,
newStr
);
taosMemoryFree
(
oldStr
);
taosMemoryFree
(
newStr
);
syncNodeEventLog
(
pSyncNode
,
tmpbuf
);
}
raftCfgPersist
(
pSyncNode
->
pRaftCfg
);
if
(
gRaftDetailLog
)
{
syncNodeLog2
(
"==syncNodeDoConfigChange=="
,
pSyncNode
);
}
_END:
return
;
}
SSyncNode
*
syncNodeAcquire
(
int64_t
rid
)
{
...
...
@@ -2275,47 +2317,11 @@ static int32_t syncNodeConfigChange(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftE
int32_t
ret
=
syncCfgFromStr
(
pRpcMsg
->
pCont
,
&
newSyncCfg
);
ASSERT
(
ret
==
0
);
// persist last config index
raftCfgAddConfigIndex
(
ths
->
pRaftCfg
,
pEntry
->
index
);
raftCfgPersist
(
ths
->
pRaftCfg
);
// update new config myIndex
syncNodeUpdateNewConfigIndex
(
ths
,
&
newSyncCfg
);
bool
isDrop
=
false
;
bool
IamInNew
=
syncNodeInConfig
(
ths
,
&
newSyncCfg
);
if
(
IamInNew
)
{
// do config change
syncNodeDoConfigChange
(
ths
,
&
newSyncCfg
,
pEntry
->
index
,
&
isDrop
);
// change isStandBy to normal
if
(
!
isDrop
)
{
char
tmpbuf
[
512
];
char
*
oldStr
=
syncCfg2SimpleStr
(
&
oldSyncCfg
);
char
*
newStr
=
syncCfg2SimpleStr
(
&
newSyncCfg
);
snprintf
(
tmpbuf
,
sizeof
(
tmpbuf
),
"config change from %d to %d, index:%ld, %s --> %s"
,
oldSyncCfg
.
replicaNum
,
newSyncCfg
.
replicaNum
,
pEntry
->
index
,
oldStr
,
newStr
);
taosMemoryFree
(
oldStr
);
taosMemoryFree
(
newStr
);
if
(
ths
->
state
==
TAOS_SYNC_STATE_LEADER
)
{
syncNodeBecomeLeader
(
ths
,
tmpbuf
);
}
else
{
syncNodeBecomeFollower
(
ths
,
tmpbuf
);
}
}
}
else
{
char
tmpbuf
[
512
];
char
*
oldStr
=
syncCfg2SimpleStr
(
&
oldSyncCfg
);
char
*
newStr
=
syncCfg2SimpleStr
(
&
newSyncCfg
);
snprintf
(
tmpbuf
,
sizeof
(
tmpbuf
),
"config change2 from %d to %d, index:%ld, %s --> %s"
,
oldSyncCfg
.
replicaNum
,
newSyncCfg
.
replicaNum
,
pEntry
->
index
,
oldStr
,
newStr
);
taosMemoryFree
(
oldStr
);
taosMemoryFree
(
newStr
);
syncNodeBecomeFollower
(
ths
,
tmpbuf
);
}
// do config change
syncNodeDoConfigChange
(
ths
,
&
newSyncCfg
,
pEntry
->
index
);
// set pFinish
pFinish
->
oldCfg
=
oldSyncCfg
;
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
3573ae15
...
...
@@ -539,42 +539,9 @@ int32_t syncNodeOnSnapshotSendCb(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
// update new config myIndex
SSyncCfg
newSyncCfg
=
pMsg
->
lastConfig
;
syncNodeUpdateNewConfigIndex
(
pSyncNode
,
&
newSyncCfg
);
bool
IamInNew
=
syncNodeInConfig
(
pSyncNode
,
&
newSyncCfg
);
bool
isDrop
=
false
;
if
(
IamInNew
)
{
char
eventLog
[
128
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"update config by snapshot, lastIndex:%ld, lastTerm:%lu, lastConfigIndex:%ld"
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
lastConfigIndex
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
syncNodeDoConfigChange
(
pSyncNode
,
&
newSyncCfg
,
pMsg
->
lastConfigIndex
,
&
isDrop
);
}
else
{
char
eventLog
[
128
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"do not update config by snapshot, not in new, lastIndex:%ld, lastTerm:%lu, lastConfigIndex:%ld"
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
lastConfigIndex
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
}
// change isStandBy to normal
if
(
!
isDrop
)
{
char
tmpbuf
[
512
];
char
*
oldStr
=
syncCfg2SimpleStr
(
&
oldSyncCfg
);
char
*
newStr
=
syncCfg2SimpleStr
(
&
newSyncCfg
);
snprintf
(
tmpbuf
,
sizeof
(
tmpbuf
),
"config change3 from %d to %d, index:%ld, %s --> %s"
,
oldSyncCfg
.
replicaNum
,
newSyncCfg
.
replicaNum
,
pMsg
->
lastConfigIndex
,
oldStr
,
newStr
);
taosMemoryFree
(
oldStr
);
taosMemoryFree
(
newStr
);
if
(
pSyncNode
->
state
==
TAOS_SYNC_STATE_LEADER
)
{
syncNodeBecomeLeader
(
pSyncNode
,
tmpbuf
);
}
else
{
syncNodeBecomeFollower
(
pSyncNode
,
tmpbuf
);
}
}
// do config change
syncNodeDoConfigChange
(
pSyncNode
,
&
newSyncCfg
,
pMsg
->
lastConfigIndex
);
}
SSnapshot
snapshot
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录