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>
This commit is contained in:
shuqiang-zheng 2025-09-23 16:10:12 +08:00 committed by 曾雪伟
parent 65ac8ca7b2
commit 5635b02677

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 {