mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #11959 from tedyu/store-clone-rd-lock
etcdserver: take read lock when cloning store
This commit is contained in:
commit
62f1fefe4a
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user