Merge pull request #11959 from tedyu/store-clone-rd-lock

etcdserver: take read lock when cloning store
release-3.5
Gyuho Lee 2020-06-03 14:13:53 -07:00 committed by GitHub
commit 62f1fefe4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -755,7 +755,7 @@ func (s *store) SaveNoCopy() ([]byte, error) {
}
func (s *store) Clone() Store {
s.worldLock.Lock()
s.worldLock.RLock()
clonedStore := newStore()
clonedStore.CurrentIndex = s.CurrentIndex
@ -764,7 +764,7 @@ func (s *store) Clone() Store {
clonedStore.Stats = s.Stats.clone()
clonedStore.CurrentVersion = s.CurrentVersion
s.worldLock.Unlock()
s.worldLock.RUnlock()
return clonedStore
}