fix(master): fix panic caused by lack of locking during concurrent access to the rafts map.

close: #1000356742

Signed-off-by: shuqiang-zheng <zhengshuqiang@oppo.com>
(cherry picked from commit 5635b02677)
This commit is contained in:
shuqiang-zheng 2025-09-23 16:10:12 +08:00 committed by chihe
parent 97855da728
commit 8042b39daa

View File

@ -40,9 +40,12 @@ type RaftServer struct {
func (rs *RaftServer) RemoveRaftForce(raftId uint64, cc *proto.ConfChange) {
var s *raft
var ok bool
rs.mu.RLock()
if s, ok = rs.rafts[raftId]; !ok {
rs.mu.RUnlock()
return
}
rs.mu.RUnlock()
// repl apply
peerChange := cc.Peer
for _, replica := range s.raftFsm.replicas {