Skip to content

Commit

Permalink
server: fix the data race problem (#3772) (#3773)
Browse files Browse the repository at this point in the history
* This is an automated cherry-pick of #3772

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* resolve conflicts

Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
ti-chi-bot and rleungx authored Jul 6, 2021
1 parent e649fe7 commit cd9d32c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1153,17 +1153,17 @@ func (s *Server) campaignLeader() {
log.Error("failed to reload configuration", errs.ZapError(err))
return
}
if err := s.persistOptions.LoadTTLFromEtcd(s.ctx, s.client); err != nil {
log.Error("failed to load persistOptions from etcd", errs.ZapError(err))
return
}
// Try to create raft cluster.
err = s.createRaftCluster()
if err != nil {
log.Error("failed to create raft cluster", errs.ZapError(err))
return
}
defer s.stopRaftCluster()
if err := s.persistOptions.LoadTTLFromEtcd(s.ctx, s.client); err != nil {
log.Error("failed to load persistOptions from etcd", errs.ZapError(err))
return
}
if err := s.idAllocator.Generate(); err != nil {
log.Error("failed to sync id from etcd", errs.ZapError(err))
return
Expand Down

0 comments on commit cd9d32c

Please sign in to comment.