Skip to content

Commit

Permalink
server: fix placement rules panic (#2070)
Browse files Browse the repository at this point in the history
Signed-off-by: disksing <i@disksing.com>
  • Loading branch information
disksing authored and sre-bot committed Dec 31, 2019
1 parent 26ba96d commit 8d883e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,12 @@ func (s *Server) SetReplicationConfig(cfg config.ReplicationConfig) error {
return err
}
if cfg.EnablePlacementRules {
raftCluster := s.GetRaftCluster()
if raftCluster == nil {
return errors.WithStack(cluster.ErrNotBootstrapped)
}
// initialize rule manager.
if err := s.GetRaftCluster().GetRuleManager().Initialize(int(cfg.MaxReplicas), cfg.LocationLabels); err != nil {
if err := raftCluster.GetRuleManager().Initialize(int(cfg.MaxReplicas), cfg.LocationLabels); err != nil {
return err
}
}
Expand Down

0 comments on commit 8d883e5

Please sign in to comment.