Use newbe instead of s.be to avoid potential race

`s.cluster.SetBackend(s.be)` is not in critical section. Using `newbe` instead of `s.be` can avoid potential data race.
This commit is contained in:
lzhfromustc 2019-07-08 14:24:52 -07:00 committed by GitHub
parent 48f5bb6d28
commit d35f6647bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1291,7 +1291,7 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) {
plog.Info("finished recovering store v2")
}
s.cluster.SetBackend(s.be)
s.cluster.SetBackend(newbe)
if lg != nil {
lg.Info("restoring cluster configuration")